I have the following script:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$(this).find("[id$='Panel']").hide();
$(".toggleDisplay").change(function () {
var groupName = $(this).find(":radio").attr('name');
var ans = $('input[name="' + groupName + '"]:radio:checked').val();
var displaylist = ["1", "2", "3", "4", "5"];
if (displaylist.indexOf(ans) > -1) {
$(this).find("[id$='Panel']").show();
} else {
$(this).find("[id$='Panel']").hide();
}
});
});
</script>
When I inserted/tested this last week, it worked fine in IE 11. Today, it stopped working. However, it still works in Chrome. The IE error I receive is: "Object doesn't support property or method 'indexOf'"
I attempted to rewrite the if statement as follows, with no luck:
if ($.inArray(ans, displayList) != -1) {}
Any suggestions?
EDIT: The issue was my browser (somehow) reverting back to rendering as IE 8. Seems that this is a company wide issue. To prevent further hiccups, is there a painless method of doing this script in IE 8-compatible code?