Revision: 45214
Updated Code
at April 27, 2011 13:12 by shabith
Updated Code
/* this will work in all browsers(no jQuery needed) */ if (!Array.indexOf) { Array.prototype.indexOf = function (obj, start) { for (var i = (start || 0); i < this.length; i++) { if (this[i] == obj) { return i; } } return -1; } } //call var i = haystack_array.indexOf("needle") /* or you can use jquery instead */ //call var i = jQuery.inArray("needle", haystack_array)
Revision: 45213
Updated Code
at April 27, 2011 13:11 by shabith
Updated Code
/* this will work in all browsers(no jQuery needed) */ if (!Array.indexOf) { Array.prototype.indexOf = function (obj, start) { for (var i = (start || 0); i < this.length; i++) { if (this[i] == obj) { return i; } } return -1; } } //call haystack_array.indexOf("needle") /* or you can use jquery instead */ //call jQuery.inArray("needle", haystack_array)
Revision: 45212
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 27, 2011 13:11 by shabith
Initial Code
/* this will work in all browsers(no jQuery needed) */ if (!Array.indexOf) { Array.prototype.indexOf = function (obj, start) { for (var i = (start || 0); i < this.length; i++) { if (this[i] == obj) { return i; } } return -1; } } //call haystack_array.indexOf("needle") /* or you can use jquery instead */ haystack_array.indexOf("needle"); //call jQuery.inArray("needle", haystack_array)
Initial URL
Initial Description
source: http://stellapower.net/content/javascript-support-and-arrayindexof-ie/<br> source: http://www.robsearles.com/2010/03/11/ie-7-indexof-replacement/
Initial Title
IE7 Array indexOf() fix
Initial Tags
array, jquery
Initial Language
JavaScript