Catch clicks on file links (as opposed to page links) in jquery?
I want to add an event to my users clicking on file links (as opposed to links to i开发者_运维知识库nternal or external pages). Is there a simple way to just get file links with a jquery selector? Or, do you think it's better to put a class on my file links and just select on the basis of that class?
thanks, max
Use $
to get links having file extension:
$('a[href$=".pdf"]')
You can replace the .pdf
with whatever file extension you want.
精彩评论