[jQuery] How to pass in string of params into Function(...,....,params)
I've been playing with this sob all day but can't figure out if I have
the syntax right here for
a) checking if the checkbox is checked inside my AddMethod
b) passing in a couple of other fields kinda like you do with the
EqualTo in terms of adding a # to the name and adding a couple of
field names to be passed to my params.
For example I want to do something like this from my .aspx:
<script type='text/javascript'>
$(document).ready(function()
{
$("#MyForm").validate
({
rules: {
mycheckbox: {testvalidatoinmethod:
"#anotherformfield1,#anotherformfield2"}
}
});
});
</script>
jQuery.validator.addMethod("testvalidatoinmethod", function(value,
element, params) {
if (value = true)
{
if (jQuery(params[0]).val() ==
jQuery(params[1]).val())
{
return true;
}
else
{
return this.optional(element)
}
}
else
{
return this.optional(element)
}
}, "Fields do not match");