我的代码如下所示:
<form id="MyForm" name="MyForm" method="post" action="index.php">
<input type="text" id="Input1" name="Input1">
<input type="text" id="Input2" name="Input2">
<div id="dialog">
<input type="text" id="Input3" name="Input3">
<input type="text" id="Input4" name="Input4">
</div>
<button type="button" onclick="$('#dialog').dialog('open');">Fill out 3 and 4</button>
<input type="submit" value="Submit">
</form>
我可以将表单的第二部分放在 JQueryUI 对话框中,Input3 和 Input4 不会出现在 POST 数据中。可以这样做吗?
最佳答案
编辑为不指定输入名称。
$('#dialog').bind('dialogclose', function(event, ui) {
$('#dialog :input').each(function(index) {
$("#myForm").add('<input>').attr({
type: 'hidden',
id: $(this).attr('id')
});
});
});
关于jquery - 在 jQueryUI 对话框中包含部分表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2339672/