What is the difference between the html () and text () jQuery methods? textjquery

Source: Internet
Author: User

What is the difference between the html () and text () jQuery methods? textjquery

What are the differences between the html () and text () jQuery methods:
The two methods in the title are very commonly used by jQuery, and sometimes the functions seem to be the same. In fact, this is just an illusion. The following uses examples to introduce their differences, first, let's look at a code example:

 

<! DOCTYPE html> 

 

In the above Code, both methods can set the content in the div to "ant tribe", which seems to have the same effect.
Let's take a look at the example code:

 

<! DOCTYPE html> 

 

The differences between the two methods are obvious in the above Code. The html () method can parse html code like a browser, while the text () method only uses html code as common text, in this way, the differences between them are obvious.

The original address is: http://www.softwhy.com/forum.php? Mod = viewthread & tid = 5794.

For more information, see: http://www.softwhy.com/jquery/

 

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.