IndexOf not Supported in IE8 Browser

前端 未结 2 1436
悲哀的现实
悲哀的现实 2021-01-12 03:56

I have cascaded dropdown in my application, cascaded using jquery, now my problem is it is working smoothly with IE9, Firefox, Opera and Safari but does not work with any of

2条回答
  •  清歌不尽
    2021-01-12 04:53

    The indexOf() method of Arrays is not implemented in IE < 9. As you're using jQuery you can make use of the $.inArray(), e.g.

    var arr = ["foo", "bar", "baz"],
        bazIndex = $.inArray("baz", arr), // 2
        doesntExistIndex = $.inArray("notThere", arr); // -1
    

    Here's the documentation: http://api.jquery.com/jQuery.inArray/.

提交回复
热议问题