javascript - Target input by value -
i have 6 inputs in html this:
<input type="radio" value="1" /> <input type="radio" value="2" /> <input type="radio" value="3" /> <input type="radio" value="4" /> <input type="radio" value="5" /> <input type="submit" onclick="myfunction();" value="submit" />
when submit button clicked, javascript function called. in javascript function, want check of radio buttons checked , aren't.
thanks in advance!
javascript
function myfunction() { var x = document.getelementsbytagname("input"); for(i = 0; < x.length; i++ ) { if(x[i].type = "radio") { if(x[i].checked) { alert(x[i].value); } } } }
javascript jquery
No comments:
Post a Comment