jQuery .submit method

html, javascript, jquery, jquery-events

Solution

try to change

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

with

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

so you call the `submit()` method available for the DOM element

Problem

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

Original source