jQuery event on value change of input hidden
event-handling, events, jquery
Solution
$(function(){
var $hello= $('[id$="myValue"]');
$hello.on("change", function(){ //bind() for older jquery version
alert('hey');
}).triggerHandler('change'); //could be change() or trigger('change')
});
Then, each time you change the value of targeted hidden inputs, trigger handler, e.g:
$('#j_idt26:myValue').val('0?200?').triggerHandler('change');
That's because onchange event is not fired automatically changing its value programatically.
Problem
I have this input hidden: ``` <input id="j_idt26:myValue" type="hidden" name="j_idt26:myValue" value="0?100?"> ``` I want to alert "hey" the first time the value is set and then every time it changes. I have something like this: ``` $(document).ready(function(){ var $hello= $('[id$=myValue]'); $hello.bind("change load", function(){ alert('hey'); }); }); ``` But nothing is showing up. If you can help Thanks