Skip to main content

Bug Tracker

Side navigation

#4778 closed enhancement (wontfix)

Opened June 17, 2009 04:06PM UTC

Closed October 02, 2010 10:32PM UTC

Last modified March 15, 2012 03:36PM UTC

Adding a change event on a hidden field

Reported by: nabab Owned by:
Priority: major Milestone: 1.4
Component: core Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:


I would like to be able to trigger a function when the value of a hidden field is changed through val() - and I want this event to be attached to the field itself, not to the val() action.

As events are only users' triggered a hidden field doesn't trigger onchange natively. I have seen a lot of implementations using various plug-ins for mutation events, but was not very happy about them - they're heavy and I got some errors.

Therefore I have added a line at the very end of the val() function:






// Here's my line:




This works fine in IE6, FF and Chrome - haven't tested on other browser.

The code I have added in the val() function is, I think, the most efficient way for being able to trigger the change function on any hidden field. However, as I love jQuery and hate to have my own twisted script instead of the standard, I wonder if people think it could be implemented in the core or if someone would have a better

global solution to that problem...


Attachments (0)
Change History (1)

Changed October 02, 2010 10:32PM UTC by snover comment:1

resolution: → wontfix
status: newclosed

A programmatic change to a field is not considered a change for the purposes of event dispatching. (Trust me, it would break a lot of stuff if it were.) You will just need to raise an event yourself if you want one after a programmatic value change to a form field.