Frage

<input type="radio" value="10" name="attack" onClick="sendid(this.value)"/> Attack 1
<input type="radio" value="20" name="attack" onClick="sendid(this.value)"/> Attack 2

When I click on the radio, immediately I get the response! But along with the response, I want to clear the check radio! How can I do that?

War es hilfreich?

Lösung

Set the checked property to false. I suggest passing the element to your function (not just its value):

onClick="sendid(this)"

JavaScript:

function sendid(element){
    element.checked = false;
}

This will work but it doesn't seem like a radio button is the most appropriate tool for this job.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top