admin管理员组文章数量:1327667
I am using Jconfirm together with jQuery to make a confirmation box.
The problem is that the .submit
does not work
Javascript
$('#delete').submit(function(e) {
e.preventDefault();
jConfirm("Are you sure you want to delete this link?", "Confirmation", function(r) {
if (r) { $('#delete').submit(); }
});
The $('#delete').submit();
seems to be dead.
HTML
<form action="bla.php" method="post" accept-charset="utf-8" id="delete">
<table>
<tr>
<td><label for="category">Category:</label></td><td><select name="category_id" id="categories">
<option value="1">test</option>
<option value="#" selected="selected">Please select</option>
</select></td>
</tr>
<tr>
<td><label for="links">Link:</label></td><td width="400"><select name="link_id" id="links">
<option value="#" selected="selected">Please select</option>
</select></td>
</tr>
<tr>
<td></td><td><input type="submit" value="Delete" ></td>
</tr>
</table>
</form>
I am using Jconfirm together with jQuery to make a confirmation box.
The problem is that the .submit
does not work
Javascript
$('#delete').submit(function(e) {
e.preventDefault();
jConfirm("Are you sure you want to delete this link?", "Confirmation", function(r) {
if (r) { $('#delete').submit(); }
});
The $('#delete').submit();
seems to be dead.
HTML
<form action="bla.php" method="post" accept-charset="utf-8" id="delete">
<table>
<tr>
<td><label for="category">Category:</label></td><td><select name="category_id" id="categories">
<option value="1">test</option>
<option value="#" selected="selected">Please select</option>
</select></td>
</tr>
<tr>
<td><label for="links">Link:</label></td><td width="400"><select name="link_id" id="links">
<option value="#" selected="selected">Please select</option>
</select></td>
</tr>
<tr>
<td></td><td><input type="submit" value="Delete" ></td>
</tr>
</table>
</form>
Share
Improve this question
edited Aug 9, 2022 at 8:36
Brian Tompsett - 汤莱恩
5,89372 gold badges61 silver badges133 bronze badges
asked May 15, 2012 at 8:32
HyperDevilHyperDevil
2,6499 gold badges42 silver badges52 bronze badges
1
- And by "not work" you mean what exactly? – Jan Hančič Commented May 15, 2012 at 8:32
1 Answer
Reset to default 10try to change
if (r) { $('#delete').submit(); }
with
if (r) { $('#delete').get(0).submit(); }
so you call the submit()
method available for the DOM element
本文标签: javascriptjQuery submit methodStack Overflow
版权声明:本文标题:javascript - jQuery .submit method - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742206085a2432838.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论