Mir*_*rod 2 javascript mootools
如何在jQuery中获取Mootools中的元素索引.例如:
this.controls.addEvent('click', function(event){
if (this.hasClass('h-inactiveslideshowcontrol')) {
alert(this.index);
}
});
Run Code Online (Sandbox Code Playgroud)
如何获取点击元素的索引?
首先循环遍历元素集合.
this.controls.each(function(element, index){
element.addEvent('click', function(event){
if (this.hasClass('h-inactiveslideshowcontrol')) {
alert(index);
}
});
});
Run Code Online (Sandbox Code Playgroud)