beautifulmind
beautifulmind

Reputation: 1

how to understand value of textbox changed?

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

Answers (3)

Sridhar R
Sridhar R

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

Hamid Bahmanabady
Hamid Bahmanabady

Reputation: 665

$('#areaMin').val('test');

$('.filterPanel input').keyup(function(){
     console.log('tada');
});

Upvotes: 0

Arun P Johny
Arun P Johny

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

Related Questions