Thread Starter
drtalk
(@drtalk)
Hi,
It won’t work for non checkboxes (e.g. text boxes). And even if .is(‘:checked’) returned the right value for non-checkboxes, it will give the wrong answer for checkboxes.
If you insist on an “AND” operator, you should negate the entire clause (which leads to no better/faster results, and in particular is just a logical negation of the “OR” clause):
if (!($(this).attr('type') == "checkbox" && !$(this).is(':checked'))) {
jsonObj[name] = $(this).val();
}
Tal