14 lines
566 B
JavaScript
14 lines
566 B
JavaScript
jQuery(document).ready(function($) {
|
|
if(null !== document.querySelector('select') && document.querySelector('select').length > 0) {
|
|
var selectPlaceholder = 'Choose an option.';
|
|
if(document.querySelector('select').hasAttribute('placeholder')) {
|
|
selectPlaceholder = document.querySelector('select').getAttribute('placeholder');
|
|
}
|
|
jQuery('select').prepend('<option/>').select2({
|
|
placeholder: selectPlaceholder,
|
|
minimumResultsForSearch: Infinity,
|
|
theme: 'default'
|
|
});
|
|
|
|
}
|
|
}); |