如何在Mootools中获取点击元素的索引 [英] How to get index of clicked element in Mootools
本文介绍了如何在Mootools中获取点击元素的索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何像在jQuery中那样在Mootools中获取元素的索引. 例如:
how to get index of element in Mootools like in jQuery. For example:
this.controls.addEvent('click', function(event){
if (this.hasClass('h-inactiveslideshowcontrol')) {
alert(this.index);
}
});
如何获取点击元素的索引?
How to get index of clicked element?
推荐答案
首先遍历元素集合.
this.controls.each(function(element, index){
element.addEvent('click', function(event){
if (this.hasClass('h-inactiveslideshowcontrol')) {
alert(index);
}
});
});
这篇关于如何在Mootools中获取点击元素的索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文