How do select a radio button with JavaScript?
I've tried select(); check(); and even .selected = true; but I still haven't gotten around to selecting that radio button. Is there any way I can accomplish this开发者_如何学Go?
You have to use the checked property:
element.checked = true;
Reference: HTMLInputElement
<input type=radio id='r'>
<script>
document.getElementById('r').checked=true;
</script>
Use .checked
Maybe you could post your code and we could give you a more complete solution?
To check a radio button I'm pretty sure it's .checked = true;
加载中,请稍侯......
精彩评论