I would like to test if an element exists but i cannot do it with $('#id')length > 0 because i am testing an input element which might not contain any characters and then it results in 0 even if it exists…
How can i test if this element exists??
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
lengthproperty is not returning the characters in the element. but the number of elements in the jQuery object. So you should be good to use length property in your case.