var ship = $("input[name=shippingamt]").length;
var counting1 = $(".submit-btn-1 li.checked:not(.title)").length;
if ((counting1 == 6)&&(ship >= 1)&&($('input[name=ideclare1]').is(":checked"))){
The above snippet is what I have so far, pretty much I have a 3 essential fields, a variable called Ship, an checklist called counting1 and a checkbox check.
But if Ship and Checklist are fine and the checkbox called ideclare1 is checked and unchecked then the value ship goes to undefined and is still class as valid as the length is >= 1.
Can any suggest how to check if a field is defined and has a length greater than 1?
Regards,
Donald
Check the
.lengthof the jQuery object.edit well if you’re just checking a regular variable, just compare it to
undefined: