У меня есть ряд кнопок, радио и кнопка отправки:Не удается получить значение с помощью кнопок радио JQuery
<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);
Тем не менее, я получаю «неопределенный» в консоли, даже когда я что-то выбираю ... что я делаю неправильно?
, когда вы называете это javascript? – krishgopinath
$ ("input [name = 'selectme_resubmit']: checked") одинарная кавычка имя – rps
@hungerpain Я вызываю js внутри функции 'selectme_act()' – user1483482