0

Thought this would be simple however having some difficulty. I want to uncheck a radio button, and even checkboxes, however, have achieved checkboxes with just simulated clicks. The below I have tried:

$( "#x" ).prop( "checked", false );
$( "#x" ).attr('checked', false);
$( "#x" ).removeAttr('checked');

I have also tried javascript checked = false and other methods, I also noticed the jQuery/UI .checkboxradio('refresh') method however could not get this to fire. Used the jQuery/UI as a whole as could not find the specific module however function did not seem available.

Anyone got a nice solution for this?

1 Answer 1

1

I have managed to check some radio buttons using the console as per the screenshot below. However, within a group, one radio seems to remain checked. In other words, to uncheck one radio, I had to check a radio from the same group

enter image description here

Apologies I have the questions not right, hopefully this was what you meant

2
  • Thanks for having a go trickier than it sounds this one. Kinda want to reset the whole form so uncheck all radio selections with javascript.
    – harri
    Aug 23, 2020 at 12:37
  • my answer is telling you html wise (nothing to do with Magento), a radio group cannot have all its options deselected. It did come to my mind to add an option that is selected by default and hide it with jquery? Aug 23, 2020 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.