Asp.net mvc - MicrosoftMvcAjax.js throws javascript error when updating table elements in IE8

In IE8 or something older, innerHTML is not supported for some elements, such as TR and TD. Unfortunately, the MicrosoftMvcAjax.js file included in the MVC 2 project uses innerHTML for the Ajax update method in Ajax.BeginForm or Ajax.ActionLink.

+4
source share
1 answer

To fix this, view line 18 from MicrosoftMvcAjax.js and replace it as follows:

Sys.Mvc.MvcHelpers.updateDomElement=function(target,insertionMode,content){if(target){switch(insertionMode){case 0:$(target).html(content);break;case 1:if(content&&content.length>0){$(target).html(content+target.innerHTML.trimStart());}break;case 2:if(content&&content.length>0){$(target).html(target.innerHTML.trimEnd()+content);}break;}}} 

Basically, I took out a call to innerHTML and replaced it with jQuery html ().

+1
source

All Articles