1

我正在尝试将 equalTo 方法与 jQuery 验证插件(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>

提前致谢!!!

4

1 回答 1

1

尝试

jQuery(function ($) {

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

演示:小提琴

于 2013-08-29T02:25:09.320 回答