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