Reputation: 1
I have a input and I change the value of input by a jquery code:
$('#areaMin').attr('value',ui.values[0]);
and I want to understand when the value changed with this jquery code:
$('.filterPanel input').change(function(){
console.log('tada');
});
when I manually fill the textbox and press enter it works but when it fill automaticly it doesn't work.what should I do?
Upvotes: 0
Views: 444
Reputation: 20408
Using SetInterval
setInterval(function() { ObserveInputValue($('.filterPanel input').val()); }, 100);
OnChange
it covers all changes
$(".filterPanel input").on("change keyup paste click", function(){
console.log('tada');
})
Upvotes: 0
Reputation: 665
$('#areaMin').val('test');
$('.filterPanel input').keyup(function(){
console.log('tada');
});
Upvotes: 0
Reputation: 388316
When the value is changed using script, the change event will not get triggered. You need to do it manually.
$('#areaMin').val(ui.values[0]).change();
Note: You need to use .val() to set the value not .attr()
Upvotes: 1