htmlcsstwitter-bootstraptwitter-bootstrap-3adminlte

Radio Button Does Not Unchecked When Clicking On Itself


I'm using Bootstrap 3 and I have a radio button like this:

<input type="radio" name="attr_var" class="minimal">
Add To Attribute

Users can properly click on it for checking it, but it does not unchecked when it's re-clicked.

Basically when it's checked, users can be uncheck it when they re-click on it but this does not workout.

So how to fix this?


Solution

  • Radio buttons are distinct from checkboxes. The user can change options between a set of radio buttons, but it cannot be deselected.

    You can refer to this answer for a better explanation as to Why is it impossible to deselect HTML "radio" inputs?

    PS. This applies to native HTML radio buttons. You can still use a checkbox for this purpose, or create your own buttons with CSS and Javascript that behave the same way.