user1158040
user1158040

Reputation: 47

IE7 jquery .each on array

Having some problems with IE7 on jquery $.each, this gives me an "Object does not support...."

arr = arr[1].split('::');
$.each(arr, function() {
   item = $(this).split("#_#");
});

Upvotes: 1

Views: 419

Answers (1)

Ben Lee
Ben Lee

Reputation: 53319

Don't use the jquery extended version. split is a native javascript method, not a jquery method.

$.each(arr, function() {
   item = this.split("#_#");
});

Note: I'm assuming here that the item = ... line is just an excerpt from a longer method.

UPDATE per @user1158040's comment: To get this to work with IE7, you may need to declare the array as an actual array object rather than an array literal. So instead of something like this:

var arr = ['abc', 'def', 'ghi'];

You'd do this:

var arr = new Array('abc', 'def', 'ghi');

Upvotes: 3

Related Questions