gpt4 book ai didi

jQuery - 在提交时向表单添加隐藏输入

转载 作者:行者123 更新时间:2023-12-03 22:54:40 25 4
gpt4 key购买 nike

我正在寻找一种方法,在下面的 jquery 代码中提交"is"时插入隐藏输入。

如何插入这个:

<input type="hidden" name="token" value="1">

从此:

$(function() {
$( "#dialog" ).dialog({
autoOpen: false,
modal: true,
buttons: {
"Yes": function() {
$( '#form' ).submit();
},
"No": function() {
$( '#form' ).submit();
},
Cancel: function() {
$( this ).dialog( "close" );
}
}
});
});

最佳答案

试试这个

$(function() {
$( "#dialog" ).dialog({
autoOpen: false,
modal: true,
buttons: {
"Yes": function() {
$('#form').append('<input type="hidden" name="token" value="1" />').submit();
},
"No": function() {
$('#form').submit();
},
Cancel: function() {
$(this).dialog( "close" );
}
}
});
});

关于jQuery - 在提交时向表单添加隐藏输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8231946/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com