32 lines
475 B
JavaScript
32 lines
475 B
JavaScript
function initMultiSelect(selector){
|
|
|
|
$(selector).select2({
|
|
placeholder: $(selector).data('placeholder'),
|
|
closeOnSelect:false,
|
|
allowClear:false,
|
|
width:'100%'
|
|
});
|
|
|
|
}
|
|
|
|
function initSingleSelect(selector){
|
|
|
|
$(selector).select2({
|
|
placeholder: $(selector).data('placeholder'),
|
|
allowClear:true,
|
|
width:'100%'
|
|
});
|
|
|
|
}
|
|
|
|
$(document).ready(function(){
|
|
|
|
$('.select2-multi').each(function(){
|
|
initMultiSelect(this);
|
|
});
|
|
|
|
$('.select2-single').each(function(){
|
|
initSingleSelect(this);
|
|
});
|
|
|
|
}); |