开发者

asp.net mvc - MicrosoftMvcAjax.js throws javascript error when updating table elements in IE8 [closed]

开发者 https://www.devze.com 2023-01-08 21:50 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago.

In IE8 or anything older, innerHTML is not supported on certain elements like TR & TD. Unfor开发者_Go百科tunately, the MicrosoftMvcAjax.js file included in the MVC 2 project uses innerHTML for the Ajax update method within the Ajax.BeginForm or Ajax.ActionLink.


To fix that, look into Line 18 of MicrosoftMvcAjax.js and replaced it with this:

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 the innerHTML call and replaced it with jQuery's html().

0

精彩评论

暂无评论...
验证码 换一张
取 消