有没有办法使用“invoke”、“observe”和“click”作为参数来访问“invoke”当前正在迭代的项目?
我正在这样做:
1.
$$('.item').invoke('observe', 'click', function(event) {
// I want to access the .item that was clicked in here
});
我可以
2.
$$('.item').first().observe('click', function(node) {
// I can access the .item right here with 'node'
})
我什至可以
3.
$$(".item").each(function(node) {
node.observe('click', function(event) {
// use 'node' here for the .item clicked
});
但我想知道是否有办法做#1(速记方式),同时仍然访问被点击的元素。
有没有办法做到这一点?