0

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!

2
  • Does your actual code have action="#" in the form tag? Cause that wouldn't post anywhere... Commented Mar 1, 2012 at 21:13
  • no it goes to gdform.asp but even if i use the # it should atleast refresh the page Commented Mar 1, 2012 at 21:15

2 Answers 2

4

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

Sign up to request clarification or add additional context in comments.

1 Comment

i was driving myself nuts with all the tutorials i've visited & bookmarked. thanks again!
0

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

Like so:

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

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


});

3 Comments

@JimmyX He doesn't have any .click() functions in the jSFiddle, wanted to make sure that in practice he was putting it in the right place.
@john where would the provided code go if you're looking at the jSFiddle javascript...
Forget my answer; I was looking at it the completely wrong way. Charlietfl's answer works. jsfiddle.net/aRkcP/2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.