I have this line in a function handling click events. It works in Firefox, but not IE8 and I don't see how to create a workaround. (Jquery answers welcome!).
n.b I cannot use the this keyword as in context it will be useless.
elementsList[i].previousSibling.lastChild.addEventListener("click", (f开发者_如何转开发unction(el){
return function(){
toggle(el)
};
})(elementsList[i]),false);
edit
To answer comments
elementsList is an array containing various nodes such as divs and p tags.
Internet Explorer does not support addEventListener before version 9.
Use a library to iron out the differences, since you mentioned jQuery, use bind
jQuery:
$( elementsList[i] ).prev().last().click(function() {
toggle( this );
});
精彩评论