$('#basicSelect').ioSelect();
null
$('#multiSelect').ioSelect({
placeholder: 'Select colors',
searchPlaceholder: 'Search colors...'
});
[]
$('#customSelect').ioSelect({
placeholder: 'Select country',
searchPlaceholder: 'Search country...',
noResultsText: 'No country found'
});
null
$('#noSearchSelect').ioSelect({
searchable: false,
placeholder: 'Select month'
});
null
The select below fetches products from the backend via AJAX as you type in the search box (example API: dummyjson.com/products/search).
$('#ajaxSelect').ioSelect({
placeholder: 'Select a product',
searchPlaceholder: 'Search products...',
noResultsText: 'No products found',
ajax: {
url: 'https://dummyjson.com/products/search',
method: 'GET',
dataKey: 'products',
queryParam: 'q'
}
});
null
In this example, you can select multiple products. Products are fetched via AJAX as you type.
$('#ajaxMultiSelect').ioSelect({
placeholder: 'Select product(s)',
searchPlaceholder: 'Search products...',
noResultsText: 'No products found',
ajax: {
url: 'https://dummyjson.com/products/search',
method: 'GET',
dataKey: 'products',
queryParam: 'q'
}
});
[]
In this example, initially selected values are set via JavaScript.
$('#initialSingleSelect').ioSelect({
initialSelected: {
id: '2',
name: 'London'
}
});
null
$('#initialMultiSelect').ioSelect({
initialSelected: [
{ id: 'red', name: 'Red' },
{ id: 'blue', name: 'Blue' }
]
});
[]
In this example, an initial value is set for an AJAX-powered select. The product with ID 1 "iPhone 9" is selected by default.
$('#ajaxInitialSelect').ioSelect({
placeholder: 'Select a product',
searchPlaceholder: 'Search products...',
noResultsText: 'No products found',
ajax: {
url: 'https://dummyjson.com/products/search',
method: 'GET',
dataKey: 'products',
queryParam: 'q'
},
initialSelected: {
id: '1',
name: 'iPhone 9'
}
});
null
In this example, multiple products are initially selected in an AJAX-powered select. iPhone 9 and Samsung Galaxy are selected by default.
$('#ajaxMultiInitialSelect').ioSelect({
placeholder: 'Select product(s)',
searchPlaceholder: 'Search products...',
noResultsText: 'No products found',
ajax: {
url: 'https://dummyjson.com/products/search',
method: 'GET',
dataKey: 'products',
queryParam: 'q'
},
initialSelected: [
{ id: '1', name: 'iPhone 9' },
{ id: '2', name: 'Samsung Galaxy' }
]
});
[]