To check weather the element is exist or not I am using
if($('#id').length)
//statement 1
else
//statement 2
It is working fine for me. But statement1 will execute when the condition is true otherwise statement2 will execute. But how is it working when length is returning length (it is a number like 1 , 2...)
I thought if the length is 0, then it is taking false
for 0
. But what about remaining cases. I am unable to understand what is happening here. Thanks in advance...