Skip to content Skip to sidebar Skip to footer

Jquery Doesn't Submit A Form

I have the following HTML code:

Solution 1:

You have a field named submit, this clobbers the submit method of the form (with a reference to the DOM node for the field) that jQuery depends on in its own submit method.

Rename it.

Solution 2:

I think you fire the submit event before the DOM is actually loaded, because if I try it, this code works:

$(document).ready(function(){

    // Submit handler, to prove everything works fine
    $('#umfrageForm').submit(function(){
        alert('hi');
        returnfalse;
    });

    // Fire the submit event
    $('#umfrageForm').submit(); // alerts 'hi'
});

See: jsFiddle

Solution 3:

yes when you have input elements with the name "submit" you will find the $('#formID').submit() to not to behave as it is expected. Just replace the input field name (may be the submit button) to something more relevant.

I know this post is old one, just had the same problem for me and thought I should post my findings.

Solution 4:

I had once similar problem. Your code should work if you include Java-script file as you show. However, I suspect your code is a part of a bigger html-document. The problem arises when you download the body part of your html-document into another html-document without including Java-script-functions in sub-document (since they are included in the parent-document). Then it will not work. You have to include Java-script file also in sub-document.

Post a Comment for "Jquery Doesn't Submit A Form"