I have tried numerous things and nothing seems to be working.
I am using jQuery and Chosen plugin.
Methods I have tried:
var select = jQuery(
var config = {
'.chosen-select' : {},
'.chosen-select-deselect' : {allow_single_deselect:true},
'.chosen-select-no-single' : {disable_search_threshold:10},
'.chosen-select-no-results': {no_results_text:'Oops, nothing found!'},
'.chosen-select-width' : {width:"95%"}
}
for (var selector in config) {
$(selector).chosen(config[selector]);
}
Use above config and apply class='chosen-select-deselect' for manually deselect and set the value empty
or if you want deselect option in all combo then apply config like below
var config = {
'.chosen-select' : {allow_single_deselect:true},//Remove if you do not need X button in combo
'.chosen-select-deselect' : {allow_single_deselect:true},
'.chosen-select-no-single' : {disable_search_threshold:10},
'.chosen-select-no-results': {no_results_text:'Oops, nothing found!'},
'.chosen-select-width' : {width:"95%"}
}
for (var selector in config) {
$(selector).chosen(config[selector]);
}