Hi all!
I love Validation plugin, it's pretty cool!
I have a simple form here:
<form name="frmTest" id="frmTest">
<input type="checkbox" name="chk1" id="chk1" />
<input type="text" name="txt1" id="txt1" title="vFalse Validation!!" /
>
<input type="submit" value="submit" name="submit" id="submit" />
</form>
and the js code which is working well:
<script type="text/javascript">
$.validator.addMethod("vFalse", function(value) {
return false;
});
$().ready(function() {
$("#frmTest").validate({
rules: {
txt1: {
vFalse: {
depends: function(element) {
return $("#chk1").is(":checked")
}
}
}
}
});
});
</script>
And my question is, why this doesn't work:
<script type="text/javascript">
$.validator.addMethod("vFalse", function(value) {
return false;
});
$().ready(function() {
$("#frmTest").validate({
rules: {
txt1: {
vFalse: "#chk1:checked"
}
}
});
});
</script>
Thanks for any help!