我在 jquery 对话中有一个表格。提交表单后如何获取所选复选框的值?
$(document).ready(function(){
var $dialog = $('<div></div>')
.html('<form id="myform" action=""><input type="checkbox" id="completeCheck" name="completeCheck" value="" />Complete check<br /><input type="checkbox" name="view" value="Car" /> View report <br /><input type="checkbox" name="consist" value="" />Consistency check<br /><input type="checkbox" name="other" value="" />Other checks<br /><input type="checkbox" name="keyCheck" value="" />Key check<br /><input type="checkbox" name="compareCheck" value="" />Compare check<br /></form>')
.dialog({
autoOpen: false,
title: 'Data check',
buttons: {
"Submit Form": function() { $('form#myform').submit();},
"Cancel": function() {$(this).dialog("close");}
}
});
$('#createNew').click(function() {
$dialog.dialog('open');
// prevent the default action, e.g., following a link
return false;
});
$('form#myform').submit(function(){
$dialog.dialog('close');
});
});