How do i disable a submit button when checkbox is uncheck?

后端 未结 7 1583
再見小時候
再見小時候 2020-11-27 21:06

I have something here that cannot seem to help me disable the submit button. any ideas?

<         


        
7条回答
  •  萌比男神i
    2020-11-27 21:54

    Try this

    $(document).ready(function(){
                    $("#postme").attr("disabled","disabled");
                        $("#checky").click(function(){
                            if($("#checky").is(":checked")){
                             $("#postme").removeAttr("disabled");   
                             }
                            else{
                                $("#postme").attr("disabled","disabled");
                                }
                        });
                    })
    

提交回复
热议问题