3

我正在使用 Jconfirm 和 Jquery 来制作一个确认框。
问题是 .submit 不起作用

Javascript

$('#delete').submit(function(e) {
e.preventDefault();
jConfirm("Are you sure you want to delete this link?", "Confirmation", function(r) {  
if (r) { $('#delete').submit(); }
});

$('#delete').submit(); 似乎已经死了。

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>
4

1 回答 1

10

尝试改变

if (r) { $('#delete').submit(); }

if (r) { $('#delete').get(0).submit(); }

所以你调用submit()可用于 DOM 元素的方法

于 2012-05-15T08:34:03.420 回答