How to solve indexOf javascript problem in internet Explorer?

indexOf is not supported by dump web browser internet explorer.
To solve this we need to add following code in our javascript file.

if (!Array.prototype.indexOf) {
    Array.prototype.indexOf = function (elt /*, from*/) {
        var len = this.length >>> 0;
        var from = Number(arguments[1]) || 0;
        from = (from < 0) ? Math.ceil(from) : Math.floor(from);
        if (from < 0) from += len;

        for (; from < len; from++) {
            if (from in this && this[from] === elt) return from;
        }
        return -1;
    };
}

You may also like...

2 Responses

  1. Ravi says:

    Thanks a lot. I was searching this from the very beginning.

  2. Volodimirsi says:

    pНатуралізм (фр. володимир швед naturalisme, лат.

Leave a Reply

Your email address will not be published. Required fields are marked *

ERROR: si-captcha.php plugin: GD image support not detected in PHP!

Contact your web host and ask them to enable GD image support for PHP.

ERROR: si-captcha.php plugin: imagepng function not detected in PHP!

Contact your web host and ask them to enable imagepng for PHP.