0

一連のラジオ ボタンと送信ボタンがあります。

<input type="radio" name="selectme_resubmit" id="selectme_resubmit1" value="first" /> <label for="selectme_resubmit1">Resubmit with the original submitter</label><br>
<input type="radio" name="selectme_resubmit" id="selectme_resubmit2" value="without" checked /> <label for="selectme_resubmit2">Resubmit without any submitter</label><br>
<input type="radio" name="selectme_resubmit" id="selectme_resubmit3" value="custom" /> <label for="selectme_resubmit3">Resubmit with a custom submitter:</label> <input type="text" name="selectme_custom_submitter" id="selectme_custom_submitter" /><br>
<input type="button" id="selectme_resubmit_button" name="selectme_resubmit2_button" value="Place a submit template" onclick="selectme_act(\'resubmit\')" />

次のjavascriptもあります(jqueryを使用):

var typeofsubmit = $("input[name=selectme_resubmit]:checked").val();
console.log(typeofsubmit);

ただし、何かを選択しても、コンソールに「未定義」と表示されます...何が間違っていますか?

4

2 に答える 2

0

コードをテストしましたが、セレクターは機能します。私が見つけた唯一の問題は、イベント'で必要のないときにキャラクターをエスケープしていたことですonclick

于 2013-07-27T18:21:41.290 に答える