How to handle change of checkbox using jQuery?

后端 未结 7 1861
失恋的感觉
失恋的感觉 2020-12-02 15:02

I have some code




7条回答
  •  执念已碎
    2020-12-02 15:35

    Hope, this would be of some help.

    $('input[type=checkbox]').change(function () {
        if ($(this).prop("checked")) {
            //do the stuff that you would do when 'checked'
    
            return;
        }
        //Here do the stuff you want to do when 'unchecked'
    });
    

提交回复
热议问题