jQuery check/uncheck radio button onclick

前端 未结 24 2775
滥情空心
滥情空心 2020-12-01 05:23

I have this code to check/uncheck a radio button onclick.

I know it is not good for the UI, but I need this.

$(\'#radioinstant\').click(function() {          


        
24条回答
  •  一个人的身影
    2020-12-01 05:53

    DiegoP,

    I was having the same trouble, until I realized that the check on the box doesnt go off until the attribute is removed. That means even if checked value is made false, it will remain there.

    Hence use the removeAttr() function and remove the checked attrib and it WILL DEFINITELY WORK.

提交回复
热议问题