garethtnash
asked on
JQuery Validate if CheckBox not Selected
Hello,
I'm a little bit stuck with this,
I have a form id = #BrandRate, on which I have the following -
checkbox #nextyear
Select List #nextyearreason
The #nextyearreason is required only if #nextyear is NOT checked...
So far I have (from here) --
I've not got very far I know! Also what if i need to add additional IDs that are required?
or different validation rules for different IDs?
Thanks
I'm a little bit stuck with this,
I have a form id = #BrandRate, on which I have the following -
checkbox #nextyear
Select List #nextyearreason
The #nextyearreason is required only if #nextyear is NOT checked...
So far I have (from here) --
<script>
$(".selector").validate({
rules: {
contact: {
required: true,
email: {
depends: function(element) {
return $("#nextyear").not(":checked")
}
}
}
}
})
</script>
I've not got very far I know! Also what if i need to add additional IDs that are required?
or different validation rules for different IDs?
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER