SCRIPT438: Object doesn't support property or method IE
After some days searching the Internet I found that this error usually occurs when an html element id has the same id as some variable in the javascript function. After changing the name of one of them my code was working fine.
This is a common problem in web applications which employ JavaScript namespacing. When this is the case, the problem 99.9% of the time is IE's inability to bind methods within the current namespace to the "this" keyword.
For example, if I have the JS namespace "StackOverflow" with the method "isAwesome". Normally, if you are within the "StackOverflow" namespace you can invoke the "isAwesome" method with the following syntax:
this.isAwesome();
Chrome, Firefox and Opera will happily accept this syntax. IE on the other hand, will not. Thus, the safest bet when using JS namespacing is to always prefix with the actual namespace. A la:
StackOverflow.isAwesome();
I have added var for all the variables in the corrosponding javascript. That solved the problem in IE.
Previous Code
billableStatus = 1 ;
var classStr = $(this).attr("id").split("_");
date = currentWeekDates[classStr[2]]; // Required
activityNameId = "initialRows_" + classStr[1] + "_projectActivityName";
activityId = $("#"+activityNameId).val();
var projectNameId = "initialRows_" + classStr[1] + "_projectName" ;
projectName = $("#"+projectNameId).val();
var timeshitEntryId = "initialRows_"+classStr[1]+"_"+classStr[2];
timeshitEntry = $("#"+timeshitEntryId).val();
New Code
var billableStatus = 1 ;
var classStr = $(this).attr("id").split("_");
var date = currentWeekDates[classStr[2]]; // Required
var activityNameId = "initialRows_" + classStr[1] + "_projectActivityName";
var activityId = $("#"+activityNameId).val();
var projectNameId = "initialRows_" + classStr[1] + "_projectName" ;
var projectName = $("#"+projectNameId).val();
var timeshitEntryId = "initialRows_"+classStr[1]+"_"+classStr[2];
var timeshitEntry = $("#"+timeshitEntryId).val();
My problem was having type="application/javascript"
on the <script>
tag for jQuery. IE8 does not like this! If your webpage is HTML5 you don't even need to declare the type, otherwise go with type="text/javascript"
instead.