Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/441.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript验证程序插件-Can';I don’我不能用表格把它用起来_Javascript_Jquery - Fatal编程技术网

Javascript验证程序插件-Can';I don’我不能用表格把它用起来

Javascript验证程序插件-Can';I don’我不能用表格把它用起来,javascript,jquery,Javascript,Jquery,我在使用JS验证程序插件时遇到问题。就我所见,所有设置都是正确的,但是错误容器不会被隐藏,也不会在单击submit时发生任何事情。控制台不会提醒我任何错误 HTML: 您是否包含了验证插件js文件?是的,就在我的jQuery includewhat for a JSFIDLE下面?那太好了:)就是这样!非常感谢。 <div class="error_container"> <p>Please correct the following errors

我在使用JS验证程序插件时遇到问题。就我所见,所有设置都是正确的,但是错误容器不会被隐藏,也不会在单击submit时发生任何事情。控制台不会提醒我任何错误

HTML:


您是否包含了验证插件js文件?是的,就在我的jQuery includewhat for a JSFIDLE下面?那太好了:)就是这样!非常感谢。
<div class="error_container">
            <p>Please correct the following errors and try again:</p>
            <ul />
          </div>

          <form id="contact_form" class="pure-form pure-form-stacked">
              <fieldset>
                 <h1>Contact Us</h1>

                  <label for="name">Your Name:</label>
                  <input id="name" type="text" placeholder="Name">

                  <label for="email">Your Email:</label>
                  <input id="email" name="email" type="email" placeholder="Email Address">

                  <label for="message">Message:</label>
                  <textarea id="message" placeholder="Message"></textarea>


                  <button type="submit" id="contact_submit" class="pure-button pure-button-primary">Submit</button>
              </fieldset>
          </form>
  $(document).ready(function(){

    $('#contact_submit').on('click', function(e){

      e.preventDefault();

      $("#contact_form").validate({
        rules: {
              email: "required"
        },
        errorContainer: $('.error_container'),
        errorLabelContainer: $('.error_container ul'),
        wrapper: 'li'
      });

    });
  });
 Try to remove  e.preventDefault(); at begin 
 event.preventDefault() method stops the default action of an element from happening.

$(document).ready(function(){

    $('#contact_submit').on('click', function(e){

          $("#contact_form").validate({
            rules: {
                  email: "required"
            },
            errorContainer: $('.error_container'),
            errorLabelContainer: $('.error_container ul'),
            wrapper: 'li'
          });

        });
      });