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

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

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

<         


        
7条回答
  •  臣服心动
    2020-11-27 21:40

    Before jQuery 1.6 attr was OK, after 1.6 you must use prop.

    $('#checky').click(function(){
      $('#postme').prop('checked', !$(this).checked);
    })
    

    Attributes and properties are different things, but unfortunately jQuery took a long time to differentiate between them.

    See also: .prop() vs .attr()

提交回复
热议问题