0

I'm trying to create an already-filled out form that will be checked on-load.

Current settings are set for onblur and on keyup. But when I tried to do pass1.load(validatePass1);, it didn't work.

Here's a jsfiddle: http://jsfiddle.net/8s3Hp/

Thanks everyone!

4

2 に答える 2

2

In this soultion, http://jsfiddle.net/8s3Hp/3/, you will see that your two validation functions are called at the end of the ready function

    $(document).ready(function(){ 
      ...
      validatePass1();
      validatePass2();
    });

Your validation is now triggered onload.

Another thing preventing the demo from working was that the form variable was not initialized, this prevented any following code from executing. I have also corrected this in the demo and you should find it working as expected.

于 2012-09-17T13:49:58.637 に答える
1
//On blur
pass1.blur(validatePass1());
pass2.blur(validatePass2());
//On key press
pass1.keyup(validatePass1());
pass2.keyup(validatePass2());

Don't forget the parenthesis at the end of a function call.

pass1.load(validatePass1());
于 2012-09-17T13:48:49.643 に答える