How to trigger checkbox click event even if it's checked through Javascript code?

前端 未结 7 1092
灰色年华
灰色年华 2021-01-30 19:39

I have many checkboxes in my page and there is a select all checkbox which checks all the checkboxes. Somehow I want to emulate that click event of checkbox even if it\'s checke

7条回答
  •  深忆病人
    2021-01-30 20:00

      $("#gst_show>input").change(function(){
    
        var checked = $(this).is(":checked");
        if($("#gst_show>input:checkbox").attr("checked",checked)){
          alert('Checked Successfully');
        }
    
      });
    

提交回复
热议问题