开发者

getting jquery tag plugin to work in IE

so I've been tryi开发者_高级运维ng to implement this: http://www.fatihkadirakin.com/dev/jquerytag/

it's a really good tag plugin which allows you to type in facebook-like tags into input field....

unfortunately though it works in firefox and chrome, it doesn't seem to work in IE as the demo demonstrates...

has anyone ever got it to work in IE and if so what changes to the js file did you make


Older IE versions don't have the indexOf method on Array, so the plugin adds this method to the Array prototype.

Later in the code, the author loops through an array using for (index in tags) without any hasOwnProperty check. Since indexOf is not a builtin property in this case, "indexOf" is one of the values that index takes on. Since a string is expected, not a function, this fails badly.

Change the loop (starting at line 146) to

            var index;
            for (index = 0; index < tags.length; index++) {
                var item = create_tag(tags[index]);
                list.append(item);
            }

and it works as expected.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜