Js method to get the value of the input click button

  • 2020-03-30 02:38:48
  • OfStack

html:
 
<input type= "radio" name="isEnd" value='1'> is  

<input type= "radio" name="isEnd" value='0' checked=checked> no  

<script type="text/javascript"> 

var isEnd; 
function getRadioVal(){ 
var temp = document.getElementsByName("isEnd"); 
for(var i=0;i<temp.length;i++) 
{ 
if(temp[i].checked){ 
isEnd = temp[i].value; 
return isEnd; 
break; 
} 
} 

} 
</script> 

Related articles: