Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to uncheck radio button javascript

I have the below radio button. When it is clicked it is not possible to clear the radio button.

the code is

<td class="Label">
<input class="Label" type="radio" name="reviewoptions_{@id}" value="other" onClick="reAssign({count(../bankguaranteedata)},document.lending.guaranteereviewoptions,this,{@id})">
<xsl:if test="guaranteereviewoptions/reviewoptions[@id='other']='checked'">
<xsl:attribute name="checked"/>
</xsl:if>
</input>Other</td>

is it possible that when its clicked again it will clear the radio button?

like image 889
topcat3 Avatar asked Mar 07 '26 05:03

topcat3


1 Answers

i actually use this:

var elements = document.getElementsByTagName("input");

for (var i = 0; i < elements.length; i++) {
        if (elements[i].type == "radio") {
            elements[i].checked = false;
        }
    }
like image 62
Ewald Bos Avatar answered Mar 08 '26 18:03

Ewald Bos



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!