Hi, Just looking for a quick hand in a question.
I am using jquery validator for a form and some dynamic fields
I am trying to have some fields required only if 2 conditions have been might, a select box selected and a radio button checked... Here is the code I am trying to get work:
if ($("input[name='package']").val() != "99" && $("input[name='nameserver_setup']:checked").val() === "SET") {
$(".yearly_ns").each(function() {
$(this).rules("add", { required: true
}); }); }
I have used this code which worked but I am not sure how to go about it with 2 conditions:
$(".1to3year").each(function() {
$(this).rules("add", {
required: function(){
switch($("#package").val()){
case "1year" :
case "2year" :
case "3year" : return true;
default: return false;
} } }); });
Am I not setting the if and && statement up right... Any help appreciated, thanks.