I got form with many fields and one is hidden... on validation i use code below to set highlight messages
jQuery('.validatedForm').validate({
errorElement: "label",
errorClass: 'profile-error',
highlight: function(element) {
$(element).css("border-color","#d44");
if($('#checkedhour').val() == "") {
$('.table tbody td').css("border","solid 1px #d44");
}
},
unhighlight: function(element) {
$(element).css("border-color","#DFD7CA");
},
});
the problem is that error also appear on the field which is hidden...this hidden field... What should i do to make error message only of hidden field does not appear but keep validation of this field?
<form>
<input type="text" required name="field1" />
<input type="hidden" required name="field2" />
<button type="submit">send</button>
</form>
When the both fields are empty the errors messages will appear after both fields as label elements.. i just want the label appear only after not hidden fields.
$(element).is(":visible");if ($(element).attr('type') == 'hidden'){}