Hi I got this error in IE. It works in all other browsers.
This is the line where error shows:
if (parseFloat(totalnumm.replace(/[^0-9-.]/g,\'\')) &g
I was going to ask what version of IE you're testing this in, but since you've specified content="IE=8
in your meta tags, that's fairly irrelevant.
The short answer is that .indexOf
for arrays is not supported in IE8 or earlier. (That includes later IE versions in compatibility mode, so your meta tag will mean that it won't work in any IE version)
Solutions:
Use a library like jQuery (or similar) which supplies an .inArray()
method that you can use instead.
You'll then need to change your code from using var.indexOf(x)
to $.inArray(var,x)
Pick this solution if you're already using jQuery (or another library that has this feature).
Use a polyfill library like this one that adds the standard .indexOf
method to the Array prototype.
This should allow you to keep your existing code unchanged; just include the library.
Use this solution if you are happy to use a library but you haven't got one already installed that would help.
Write your own function that does the same job using a for()
loop.
This is a complete change in how you find things in your arrays, but does mean you don't need to use any extra libraries.
Use this solution if you don't want to (or can't, for whatever reason) use a third-party library.
Remove your IE8 meta tag (it's pretty bad anyway, so that's a good idea) and only support your site for users with IE9 or better.
Use this solution if you're happy to stop supporting older IE versions.
In fact, it would be a good idea to do this anyway; there's no good reason to be using the meta tag to force IE into compatibility mode. Better to set it to content="IE=edge"
. That will remove the problem entirely for newer IE versions. If you do need to support IE8 or earlier, then this solution won't solve the problem and you'll need to also use one of the other solutions above, but I'd still recommend doing it anyway, because as things stand you are deliberately removing features from newer IE versions for no good reason.