jquery.validate using EqualTo for matching input value with div innerhtml value
I have a anti-spam script that inserts a random number into a div. User has to copy that number into a text field.
I'm using jquery.validate to do all my validations.
How would I use EqualTo to match text field with div html?
I'm thinking it's something along the lines of:
$.validator.addMethod("spmCheck", function(value, element) {
return value == $("#chk_rand_users").html();
}, "Please enter the correct spam check value");
<!--- html --->
<input type="text" class="required spamCheck valid" maxlength="4" id="spmchck_users" name="spmchck_users">
But, I don't know how to wire it all up.
Cheers,
Paul