Remove attribute “checked” of checkbox

后端 未结 9 1215
野的像风
野的像风 2020-12-11 00:11

I need remove the attribute \"checked\" of one checkbox when errors occur.

The .removeAttr function not work. Any idea? :/

HTML

9条回答
  •  一整个雨季
    2020-12-11 00:40

    using .removeAttr() on a boolean attribute such as checked, selected, or readonly would also set the corresponding named property to false.

    Hence removed this checked attribute

    $("#IdName option:checked").removeAttr("checked");
    

提交回复
热议问题