سؤال

<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?

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top