Pregunta

this error message apears if I'm using the validationEngine in the Internet Explorer 8 (not tried other versions). in this message is written that the problem is at line 714, 4th character, where is this code:

if(!required && !(field.val()) && field.val().length < 1 && rules.indexOf("equals") < 0) options.isError = false;

I don't know where is the problem

¿Fue útil?

Solución

.indexOf isn't supported in <= IE8.

As a workaround you could create a custom indexOf() implementation, placed in perhaps a centralised JS script file targeted for IE8. For example,

// create self-invoking anonymous indexOf() function
(function () {
    if (!Array.prototype.indexOf) {
        Array.prototype.indexOf = function (obj, start) {
            for (var i = (start || 0), j = this.length; i < j; i++) {
                if (this[i] === obj) {
                    return i;
                }
            }
            return -1;
        };
    }
})();
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top