Changing .prop using jQuery does not trigger .change event

后端 未结 1 1528
我寻月下人不归
我寻月下人不归 2020-11-27 03:14

I\'ve got an event listener on a checkbox:


My event listener:

$(\'input[         


        
相关标签:
1条回答
  • 2020-11-27 04:01

    Change event is fired when the value is changed by users interaction on page and not when value is modified using code.

    Here you need to use .change() or .trigger("change") after changing the property:

    $('input[type="checkbox"][name="something"]').prop("checked", false).change();
    

    Working Demo

    0 讨论(0)
提交回复
热议问题