Reputation: 2000
I want to run a function whenever the search input box is changed in chosen (jquery dropdown plugin). But unable to find such event neither in their documentation nor on the net. Does anyone have experienced or have idea how to call some code whenever search is done in Chosen?
I tried placing the jquery .on('change' event on the textbox but it didn't work.
I wrote
$(".chosen-search input").on("change", function(e) {
//console.log($(this));
});
Upvotes: 1
Views: 2763
Reputation: 11
Chosen js filters dropdown list onkeyup
event. This snippet would work better:
$(document).on('keyup', '.chosen-search input', function() {
console.log('filtered');
})
Upvotes: 1
Reputation: 2354
I had to "double" wrap the on
to get the input
event to fire on the Chosen text field search box:
$('#my-chosen-input').on('chosen:showing_dropdown', function() {
$('.chosen-search input').on('input', function() {
// The text has changed, do something...
});
});
Upvotes: 4
Reputation: 1107
$(".chosen-search").change(function(){
console.log("changinn");
});
This should work
Upvotes: 1