Check if checkbox is checked with jQuery

后端 未结 23 3050
忘了有多久
忘了有多久 2020-11-21 23:12

How can I check if a checkbox in a checkbox array is checked using the id of the checkbox array?

I am using the following code, but it always returns the count of ch

23条回答
  •  伪装坚强ぢ
    2020-11-21 23:53

    I know the OP want jquery but in my case pure JS was the answer so if anyone like me is here and do not have jquery or do not want to use it - here is the JS answer:

    document.getElementById("myCheck").checked
    

    It returns true if the input with ID myCheck is checked and false if it is not checked.

    Simple as that.

提交回复
热议问题