Manipulating RadioButton to have no value in any field

2

I need some help from you: I have two radiobutton , and I wanted to turn them into checkbox , only I can not change type to checkbox , in this radio I could make to select and to remove if you want.

Could anyone help me?

    
asked by anonymous 09.03.2017 / 13:51

1 answer

0

Leonardo,

Put one of these options into the onClick of your radioButton:

this.checked = false;
$(this).prop('checked', false);
$(this).attr('checked', false);
$(this).removeAttr('checked');

If put into a separate javascript you can replace this with '#idRadioBtn'

You can also search for all elements of the radio type:

$("input:radio").attr("checked", false);
$("input:radio").removeAttr("checked");

The above operations are to uncheck the selected element, to do otherwise simply change the parameters false to true .

You may need a control logic. To check what element status it uses:

document.querySelector('input[name="nomeSeuRadio"]:checked').value;
    
09.03.2017 / 13:59