I want to create a radio button that can have an unchecked value. So I created the code:
$('form').on('click', 'input[type="radio"]:checked', function (event) {
$(this).prop("checked", false);
});
Well, this is pretty straightforward: click on a checked radio, uncheck it.
But, what happens is that it never checks the radio in the first place. When I click an unchecked radio it checks before detecting if is checked, then considers it checked and unchecks it.
Well, this is not a duplicate as it asks a different question. It's not about how to uncheck, but how to automatically uncheck upon clicking.
How can I go around this problem?