The JQuery HTML () method does not use a problem that cannot display content _jquery

Source: Internet
Author: User
$ ("#content"). HTML (data.content); 
$ ("#content") [0].innerhtml = Data.content;

Today, I encountered jquery in the HTML method can not use, only to use the most basic innerhtml to show the content. The specific reason has not found, certainly with the content, the display of HTML put up for later check the reason, is I received csdn an email.

<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >  

The following are additional users:

jquery is generally very useful, but sometimes it also has some problems, such as the jquery HTML () method to set the HTML code, in one case, IE6, IE7, IE8 can not set the HTML code. The problem that this article addresses is only for browsers below IE8 (including IE8).

1. Under what circumstances IE6, IE7, IE8 jquery.html ("xxx") methods will not set up HTML code?

A: The following conditions appear in the loaded HTML code, IE8 (including IE8) is not set to HTML code:

A the HTML code being set contains references to other JS, such as: <script src= "Stone.js" type= "Text/javascript" ></script> in this case, setting the HTML code is invalid.
b The HTML code that is set contains the JS method, such as: function Stone () {alert ("My name is Mt");}, the HTML code set is invalid.
c The HTML code being set has CSS style, such as:. Stone ul li{List-style:none;float:left; , and so on, the HTML code set is invalid. [Attach: The HTML code being set if it contains references to other external

Style, such as: <link href= ". /css/style.css "rel=" stylesheet "type=" Text/css "/>", although the HTML settings are not affected, the referenced CSS is invalid and has no style. ]

2. Causal Analysis:

A: The html,jquery is simply parsed into HTML and does not ignore other factors and codes, all of which cause the above problems to arise.

3. Solution:

A: Remove the Set JS reference CSS Reference and code can be resolved.

Stone make the collation, quote please specify the source thank you for your cooperation, contact qq:1370569 "

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.