I am attempting to capture when a text input field’s value is changed. I am using:
$("input[name=color]").change(function(){
This works if I type the new value in directly. However, the value of the input field is being changed by jquery. There are several of these fields, and I need to know when any have changed. Is there a way to detect this change?
Sorry, I wasn’t clear. I’m not the one changing the value. It’s an addon that I would rather not modify in case I need to port it to another project.
WORK-AROUND
Ok, so you can’t do what I wanted to do, but here is a work-around. I just made an interval and changed my change event to an each event.
setInterval(function(){
$("input[name=color]").each(function(){ my code })
},100);
There is no way to detect the changes done programmatically.
However you can trigger a
changeevent whenever you modify its value.