Nathan Friend
Nathan Friend

Reputation: 12834

Toggleable radio buttons

I'm writing a form that has several mutually exclusive options, but none of them are required. Because of this, I'd like the user to be able to click on an already selected radio button to uncheck it, returning the set of buttons to their state when the page was first loaded (no buttons selected).

Is there a plugin that will do this for me?

Upvotes: 0

Views: 348

Answers (3)

Sarah
Sarah

Reputation: 91

I think your question is kind of similar to this one: How to check/uncheck radio button on click? You can basically use javascript (the answer on that question uses jQuery) to make the buttons toggleable. Good luck!

Upvotes: 0

Jukka K. Korpela
Jukka K. Korpela

Reputation: 201758

The robust way is to add a radio button into the group, with a label like “None”. This may of course require a small addition to the server-side code that processes the form data.

Upvotes: 1

Hass
Hass

Reputation: 1636

You can't actually do that and you shouldn't over-think the solution. Why don't you try adding a "None of the above" option or something along those lines?

Upvotes: 1

Related Questions