Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery detect programatic change to field

Tags:

jquery

I have a hidden field called #myHiddenField say.

The content of this field is programatically changed at various places.

I'd like a method that detects that change. The change event won't fire unless I type into the field but this is impossible.

Is there a jQuery way to detect programatic content change in a field?

like image 644
griegs Avatar asked Nov 17 '10 00:11

griegs


1 Answers

You should be able to trigger the change event with:

$('#myHiddenField').change(); 

OR

$('#myHiddenField').trigger('change'); 

Of course this will require the block of code responsible for updating the filed to make one of those calls after it has done its work.

like image 109
prodigitalson Avatar answered Oct 05 '22 01:10

prodigitalson