I need to find any <a> tags, which its href ends with 'pdf' and not contains 'test'.
like this;
<a href="/abc/tes.pdf">link</a>
All I know is the first condition;
jQuery('a[href$=".pdf"]')
Teach me the rest.
Thank you.
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.
Or better:
And here’s the reason:
EDIT: The “better” may not be correct here, [value$=”name”] isn’t CSS2 pure selector either, but jQuery documentation doesn’t mention that. Some additional research is required here…
EDIT 2: It looks like I didn’t thought this through. What you probably want is:
Which reads: select all
aelements which havehrefattribute that ends with “.pdf” but do not selectaelements which have “test” as a substring anywhere inhrefattribute.http://api.jquery.com/category/selectors/