在 jquery ui 中提交表单
我有几个表单,它们的名称不同,我的 php 代码创建这些表单。
所以我创建了一个动态 javascript,它采用表单 id 并提交它。 但是提交不起作用,并且没有任何错误!
我的 javascript 代码:
$( ".create_form" )
.click(function() {
var b = $(this).attr('id');
$tempId = ("#dialog-form" + b);
$tempName = ("#NemberForm" + b);
//==========
$( $tempId ).dialog({
autoOpen: false,
height: 200,
width: 350,
modal: true,
buttons: {
"accept": function() {
$($tempName).submit(function() {
return true;
})
$( this ).dialog( "close" );
}
},
Cancel: function() {
$( this ).dialog( "close" );
}
})
$( $tempId ).dialog( "open" );
});
});
我的表单代码:
<form method="post" id="NemberForm1" action="index.php?file=trade&operation=accept&id=1&flag=true">
<label for="name">number of trade</label>
<input type="text" name="number" id="number" class="text ui-widget-content ui-corner-all" />
</form>
i have several form that their name are different, my php code create these forms.
so i created a dynamic javascript that take form id and submit this.
but submit doesnt work and it haven
t any error!!!
my javascript code:
$( ".create_form" )
.click(function() {
var b = $(this).attr('id');
$tempId = ("#dialog-form" + b);
$tempName = ("#NemberForm" + b);
//==========
$( $tempId ).dialog({
autoOpen: false,
height: 200,
width: 350,
modal: true,
buttons: {
"accept": function() {
$($tempName).submit(function() {
return true;
})
$( this ).dialog( "close" );
}
},
Cancel: function() {
$( this ).dialog( "close" );
}
})
$( $tempId ).dialog( "open" );
});
});
my form code:
<form method="post" id="NemberForm1" action="index.php?file=trade&operation=accept&id=1&flag=true">
<label for="name">number of trade</label>
<input type="text" name="number" id="number" class="text ui-widget-content ui-corner-all" />
</form>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要使用:$($tempName).submit();
You need to use: $($tempName).submit();
您的 javascript 似乎有错误:
There looks like you have an error in your javascript: