我在表单jquery对话框中使用了radio类型,就像这样
<div id="updateDialog" title="Update">
<div class="box-update">
<form id="d-form" action="" method="post">
<div class="group-r">
<label for="employe_status" class="label-r">Status :</label>
<div class="ctrl-radio">
<input type="radio" value="New Employee" id="employe_statusradio1" name="employe_status" />
</div>
<div class="radio-txt for-w-small">New Employee</div>
<div class="ctrl-radio">
<input type="radio" value="Internaly Transitioning Employee" id="employe_statusradio2" name="employe_status" />
</div>
<div class="radio-txt">Internally Transitioning Employee</div>
<font color="red">*</font>
</div>
</form>
</div>
当对话框打开时,为什么无线电的值是空的(我右键点击并检查元素),所以当我提交此表单时,没有帖子价值....任何想法,请。感谢名单
答案 0 :(得分:0)
您的代码有效:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js'></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" />
</head>
<body>
<div id="updateDialog" title="Update">
<div class="box-update">
<form id="d-form" action="" method="post">
<div class="group-r">
<label for="employe_status" class="label-r">Status :</label>
<div class="ctrl-radio">
<input type="radio" value="New Employee" id="employe_statusradio1" name="employe_status" checked="checked" />
</div>
<div class="radio-txt for-w-small">New Employee</div>
<div class="ctrl-radio">
<input type="radio" value="Internaly Transitioning Employee" id="employe_statusradio2" name="employe_status" />
</div>
<div class="radio-txt">Internally Transitioning Employee</div> <font color="red">*</font>
</div>
</form>
</div>
</div>
<button id="update">Update</button>
</body>
<script type="text/javascript">
$('#update').button().click(function () {
$( '#updateDialog' ).dialog( 'open' );
//alert();
});
$('#updateDialog').dialog({
autoOpen: false,
buttons: {
'Update': function () {
bValid = $("#d-form").valid();
if (bValid) {
$('#ajaxLoadAni').fadeIn('slow');
$(this).dialog('close');
alert($('#employe_statusradio1').val() + $('#employe_statusradio2').val());
} else {
}
},
'Cancel': function () {
$(this).dialog('close');
}
},
width: '800px'
}); //end update dialog
</script>
</html>