简体   繁体   English

使用jQuery表单时无法提交表单

[英]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/ 这是我当前正在使用的代码的链接... 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. 如果邮政编码大于97999,则设计为在页面底部的div标签中显示错误。

the functionality works fine, for example if you put in 98104 as the zip it shows an error. 该功能运行良好,例如,如果您将98104放在zip中,则会显示错误。 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... 但是,如果您输入有效的邮政编码(例如18954),它将无法进入任何地方,就好像提交按钮将无法使用...

I don't know where to place the code in the javascript section to get the form to work properly. 我不知道将代码放在javascript部分中的什么位置才能使表单正常工作。

i've tried the following from other posts on Stackoverflow and they haven't worked for me. 我已经从Stackoverflow上的其他帖子中尝试了以下内容,但它们对我没有用。

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. 我将代码放在<script type="text/javascript">部分下。

If you could please review the code on the link and possibly provide a easy to understand explanation. 如果可以,请查看链接上的代码,并可能提供易于理解的解释。 Thanks! 谢谢!

如果您在小提琴中有处于调试模式的验证插件,则表单不会按设计提交

Are you putting the .click() inside of a $(document).ready() ? 您是否将.click()放入$(document).ready()

Like so: 像这样:

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

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


});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM