因此,我使用以下内容来捕获选中的单选按钮的值,它在 Chrome 中运行良好,但在 Firefox 中,我只是将未定义为 Activity 值。
关于它可能是什么,或者我如何解决它的任何想法?
$("#registerResultsButton").click(function () {
var Competition = $("body").attr("data-competitionId");
var Activity = $('input:radio[name=group1]:checked').val();
console.log(Competition + Activity);
});
HTML 看起来像:
<input type="radio" name="group1" value="1101" data-toggle="radio"> meetings taken (5 points)
<label class="radio">
<span class="icons">
<span class="first-icon fui-radio-unchecked"></span>
<span class="second-icon fui-radio-checked"></span>
</span>
<input type="radio" name="group1" value="1111" data-toggle="radio"> closed restaurants (50 points)
</label>
<label class="radio">
<span class="icons">
<span class="first-icon fui-radio-unchecked"></span>
<span class="second-icon fui-radio-checked"></span>
</span>
<input type="radio" name="group1" value="1121" data-toggle="radio"> upsell (100 points)
</label>
</div>
</div>