jQuery Validation插件 - equalTo不起作用

时间:2013-08-29 02:23:43

标签: jquery forms jquery-validate

我正在尝试将equalTo方法与jQuery Validation Plugin(http://jqueryvalidation.org/equalTo-method)一起使用,但它无效。谁能帮我弄清楚什么是错的?

HTML:     

<input type="text" name="email-again" id="email-again" placeholder="Confirm Email" class="ss-q-short" required />

jQuery的:

<script type="text/javascript">

$(function(){
$("#ss-form").validate({

   rules: {
   entry_123: "required",
       email-again: {
       equalTo: "#entry_123"
       }
   }



}); // end of function validate
}); //end of general function

</script>

提前致谢!!!

1 个答案:

答案 0 :(得分:1)

尝试

jQuery(function ($) {

    $("#ss-form").validate({
        rules: {
            entry_123: "required",
            "email-again": {
                equalTo: "#entry_123"
            }
        }
    }); // end of function validate
});

演示:Fiddle