Reputation: 1306
I'm a noob with JQuery so with that said, what I need to do is get an id that's in a hidden input. This id will dynamically change and I need JQuery to be made aware of this change and alert the id that's in the input every time it changes. What would I use to do this?
Upvotes: 1
Views: 105
Reputation: 337590
If the value of the hidden input is changed by code, there is no native DOM event which will be raised for you to capture.
Instead you would have to manually raise an event, or just fire off a function at the point in code where the value changes. Something like this:
$('#foo').val(1337).trigger('dynamicChange');
// in another file, far far away
$('#foo').on('dynamicChange', function() {
// do stuff
});
Upvotes: 4