<span>This is the span I want to select</span>
<div>something here</div>
<a id="start"></a>
Suppose can only access $(‘#start’),
I tried $(‘#start’).prev(‘span’) but not working.
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.
same code using jsbin sandbox
Note:
you can’t use prev() as it only gets the previous tag, and span, from the anchor tag is not the previous is the previous of the previous
from jQuery Documentation
the filter is to filter if the previous tag contains more than one, like:
to get the span you use: