How to check/uncheck radio button on click?

后端 未结 18 1281
情深已故
情深已故 2020-11-29 02:16

I want to be able to uncheck a radio button by clicking on it.

So, if a radio button is unchecked, I want to check it, if it is checked, I want to uncheck it.

<
18条回答
  •  有刺的猬
    2020-11-29 02:29

    Yes you can also do this on click checked, again click uncheck. Here is the logic of this:

    $('input[name=check1]').prop('checked',!$('input[name=check1]').prop('checked'));
    

提交回复
热议问题