开发者

this.each and IE6-7

I've wrote a jQuery plugin for a project and it works perfectly in all browsers but IE6-7.

I found the problem, it's in this line:

return this.each(function(index) {  my_code  })

.each doesn't work in IE6-7 properly. This bug was fixed in the latest jQuery versions but I stack with 1.4.2 and can't update it. How can I rewrite i开发者_如何学Ct? Apparently I can't do this

return for ( var index=0; i<this.length; i++ ) {

or this

for ( var index=0; i<this.length; i++ ) { return

but there should be some way around.


You identified the current jQuery fixed IE 6-7 issues. How about rewriting the jQuery.each function in your own script

http://jsfiddle.net/pxfunc/7q94J/

jQuery.extend({
    each: [1.6.2 each function here]
});


Something like:

var l = this.length;
var i = 0;
var results = []
for(i=0; i<l; i++){
   results.push( ... )
}

return results;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜