jQuery event on value change of input hidden

后端 未结 4 750
遇见更好的自我
遇见更好的自我 2021-02-05 17:40

I have this input hidden:


I want to alert \"hey\

4条回答
  •  半阙折子戏
    2021-02-05 18:00

    $(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.

提交回复
热议问题