fix indexOf in internet explorer

11:26 AM

(3) Comments

when you try to use indexOf javascript it will not work on ie
the perfect solution is to create simulated function if indexOf not exists

if(!Array.indexOf){
    Array.prototype.indexOf = function(obj){
        for(var i=0; i<this.length; i++){
            if(this[i]==obj){
                return i;
            }
        }
        return -1;
    }
}

eslam

,

3 Responses to "fix indexOf in internet explorer"

April 4, 2012 at 9:02 AM
This comment has been removed by the author.
June 12, 2012 at 10:04 AM
This comment has been removed by the author.
June 12, 2012 at 10:05 AM
Thanks for the help! I'm really having some problems about indexing in the internet explorer.
http://aranzamendezdesign.com/

Post a Comment