我正在试图找出为什么当我通过ajax提交此表单时由于某种原因它总是希望发送1作为值而不是所选内容的值。
$('input[name="program_id"]').click(function(){
if ($(this).is(':checked'))
{
alert($(this).val());
}
});
$("#pageOneSubmission").click(function(event) {
event.preventDefault();
var program_id = $('input[name="program_id"]:checked').length <= 0 ? 0 : $('input[name="program_id"]').val()
<div class="panel-body">
<div class="col-md-6 lenght">
<div class="calendar-stack fa-12x img-radio">
<i class="fa fa-calendar-o"></i>
<span class="calendar-day">26</span>
</div>
<button type="button" class="btn btn-default btn-radio">SELECT PROGRAM</button>
<input type="radio" class="hidden" name="program_id" value="1">
</div>
<div class="col-md-6 lenght">
<div class="calendar-stack fa-12x img-radio">
<i class="fa fa-calendar-o"></i>
<span class="calendar-day">46</span>
</div>
<button type="button" class="btn btn-default btn-radio">SELECT PROGRAM</button>
<input type="radio" class="hidden" name="program_id" value="2">
</div>
</div>