I have the following example:
Is there a way to check if this element exists and ha
You could do:
if($('.input1').length && $('.input1').val().length)
length evaluates to false in a condition, when the value is 0.
length
false
0