When using jquery's HTML () method, sometimes the HTML code added inside contains some special characters that need to be escaped.
The following example:
inst_html = "<a style=color:white ' onmouseover = '";
inst_html + = "javascript:showme (' +inst.instid+" _ "+valid+");
inst_html + = "'";
If you write this directly, in the Chrome and FF browsers, there is no problem, but the IE8 will be an error.
The solution is to change the ' escape ' in JavaScript so that it doesn't complain.
As the previous example read:
inst_html = "<a style=color:white ' onmouseover = '";
inst_html + = "javascript:showme (' +inst.instid+" _ "+valid+");
inst_html + = "'";
$ ("#inst_div_" +valid). HTML (inst_html);
Part of the word escape is as follows:
& Symbol: "&", "&"
• Double quotes: "\" "," ""
• Less than: "<", "<"
• Greater than: ">", ">"
• Single quote: "'", "'"
This article on jquery's HTML method contains special characters in the processing is small to share all the content of everyone, hope to give you a reference, but also hope that we support the cloud habitat community.