Let say I have,
<a id="a123"></a>
Now I need to check whether $(“a”) selector contains $(“#a123”) element.
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.
If you want to find whether
ahas thisa123id then you can do it usingismethod which returnstrueif it matches the selector else returns false.If you want to find if
acontains child with ida123then usehasmethod which reduces the set of matched elements to those that have a descendant that matches the selector or DOM element..References:
is()– http://api.jquery.com/is/has()– http://api.jquery.com/has/