Alex Rivera | Logout

change event of html hidden field

Asked 2010-11-01T07:58:24.643
41

I want to check the change of html hidden field using jquery and i tried for this but the change event did not worked.

Somebody has and idea how to handle this?

Edit
Report

2 Answers

79

The change event doesn't fire when the value is programmatically changed, if it did it would cause infinite loops in many situations.

If you need the event to fire, then trigger it when changing the value yourself using .change(), like this:

$("#hiddenId").val("new value").change();

.change() is a shortcut for .trigger("change") or, if you don't want that change event to bubble for some reason, then use .triggerHandler("change").

answered 2010-11-01T09:50:29.683
-3

in this case you know exactly, when the value changes (onchange of dropbox), because you change it by your code, so there is no need to catch an event.

simply call your reaction function in the onchange part of your dropbox event.

answered 2010-11-01T08:15:09.323

Your Answer