作者averywu (看文不要只会用横的看)
看板Ajax
标题[问题] Bind 事件时抓取自已?
时间Mon Dec 24 20:57:36 2012
$('.somespan').bind('click',function(){
var str = $(this).attr('alt')
alert(str)
})
当然上面是不能用的,有法子达到上述效果吗?
当绑定事件在一群相同元素上时,抓到触发事件的那个元素要怎麽抓呢?
用 $(this) 行不通,用 this 也行不通。
--
小恶魔的家
http://blog.pixnet.net/shiuju/
--
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 60.251.237.155
1F:→ akiratw:$(this) 为何不能用…? 12/24 21:04
2F:→ kerash:我测试可以 12/24 21:05