I'm curious if the code
var $d = $('#person_data[document_type]');
if ($d.length != 0) {
if ($d.val().length != 0 ) {...}
}
that was taken from SO jQuery: checking if the value of a field is null (empty) is the best of the best?
Can I use
var $d = $('#person_data[document_type]');
if ($d.length) {
if ($d.val().length) {...}
}
instead?
Which one is better?