I have these two select type of HTML:
<label for="h_slat_type">Slat Type</label>
<select name="h_slat_type" id="h_slat_type">
<option disabled="disabled" selected>Select</option>
<option disabled="disabled">---------</option>
<option value="1">Type 1</option>
<option value="2">Type 2</option>
</select>
<label for="v_slat_type">Slat Type</label>
<select name="v_slat_type" id="v_slat_type">
<option disabled="disabled" selected>Select</option>
<option disabled="disabled">---------</option>
<option value="1">Type 1</option>
<option value="2">Type 2</option>
</select>
The condition for validation to fail is when I have both h_slat_type and v_slat_type set as 2.
In other words if:
h_slat_type 1 = v_slat_type 1 -> true
h_slat_type 2 = v_slat_type 1 -> true
h_slat_type 1 = v_slat_type 2 -> true
h_slat_type 2 = v_slat_type 2 -> false
The JS method:
jQuery.validator.addMethod("typecheck", function(value, element) {
return ($('#h_slat_type').val() == $('#v_slat_type').val());
}, "Horizontal Type 2 and Vertical Type 2 incompatible!");
What would work in this case? ty vm.
return ($('#h_slat_type').val() + $('#v_slat_type').val()) == 4;but I don't get the expected result.