user1238870
user1238870

Reputation:

Unable to submit form when using jquery forms

Here is a link to the code I'm currently working with... http://jsfiddle.net/pixelpushing/aRkcP/

It was design to displays an error in a div tag at the bottom of the page if a zip-code is greater than 97999.

the functionality works fine, for example if you put in 98104 as the zip it shows an error. However if you type in a valid zip like 18954 it won't go anywhere it's as if the submit button won't work...

I don't know where to place the code in the javascript section to get the form to work properly.

i've tried the following from other posts on Stackoverflow and they haven't worked for me.

See codes i've tried below.

$('#myform').submit(function(){return true;});

$('#other').click(function() {
  $('#target').submit();
});

Am I putting the code in the wrong place? I place the code under the <script type="text/javascript"> section.

If you could please review the code on the link and possibly provide a easy to understand explanation. Thanks!

Upvotes: 0

Views: 744

Answers (2)

charlietfl
charlietfl

Reputation: 171679

If you have the validation plugin in debug mode, which the fiddle does, form won't submit by design

Upvotes: 4

James Glass
James Glass

Reputation: 4300

Are you putting the .click() inside of a $(document).ready()?

Like so:

$(document).ready(function() { /

    $('#other').click(function() {
        $('#target').submit();
    });


});

Upvotes: 0

Related Questions