【发布时间】:2012-01-12 00:23:00
【问题描述】:
我正在尝试编写一个脚本,该脚本将找到所有目标为 jpg、gif 或 png 的 <a> 标签,并为其附加一个函数。
$('a')
.filter(function(){
return this.href.match(/*probably some regex here?*/)
})
.bind('mouseover', function(){
alert('foo');
})
这应该可以,但我不知道正则表达式会是什么样子。如果有更好的方法,也请告诉我。谢谢!
【问题讨论】: