开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜