Possible Duplicate:
IE9 array does not support indexOf
My Code:
var arrFruits = ['apple', 'banana', 'carrot', 'dates'];
var position = arrFruits.indexOf( 'carrot' );
position > -1 && arrFruits.splice( position, 1 );
alert( arrFruits );
The above code is displaying the result as apple, banana, dates in Chrome. But it is not working in IE9.
It may be issue of
.indexOfnot being supported. It basically is supported in IE9 unless some malicious doctype is triggering it to render page in IE7/8 mode. ThanArray.indexOfmethod is not supported.I suggest using HTML5 doctype for example (
<!DOCTYPE html>) to make sure IE9 is rendering correctly.