こんにちは
現在JSを勉強しています
タイトル通りなのですがradioボタンの情報を取得するにはどうすればいいのでしょうか?
コードを書いてみたのですがうまくいきません
ご指導お願いします
JavaScript
1<!doctype html> 2<html> 3<head> 4 <meta charset="utf-8"> 5</head> 6<body> 7 <form id = myForm> 8 試し1 9 <input type = "radio" id = "test"> 10 <br> 11 試し2 12 <input type = "radio" id = "test"> 13</form> 14 <br> 15 <input type = "button" id = btn value = "Click" onclick = "test_click();"> 16 17 <script> 18 function test_click(myForm){ 19 var radio = document.getElementById('myForm'); 20 if(myForm.radio[0].cheked){ 21 console.log("a"); 22 } else { 23 console.log("b"); 24 } 25 } 26 </script> 27</body> 28</html> 29
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。