The difference between the append () function and the HTML () function

Source: Internet
Author: User

The difference between the append () function and the HTML () function:
In fact, the difference between the two functions is quite large, such as the Append () function can append an element object to the end of the specified element, and the HTML () function is not allowed.
Their most similar function is when setting HTML content for the specified element.
The code example is as follows:

<!DOCTYPE HTML><HTML><Head><MetaCharSet= "Utf-8"><Metaname= "Author"content= "http://www.softwhy.com/" /><title>Ant Tribe</title><Scriptsrc= "Http://libs.baidu.com/jquery/1.9.0/jquery.js"></Script><Scripttype= "Text/javascript">$(function(){  $("#append"). Append ("<b> Ant Tribe </b>"); $("#html"). HTML ("<b> Ant Tribe </b>")});</Script></Head> <Body><DivID= "Append"></Div><DivID= "html"></Div></Body></HTML>

At this point they are somewhat similar in function, but in fact there are differences in nature:
The append () function is to append content to the end of the specified element, while the HTML () function resets the HTML content inside the element.
Related reading:
The 1.append () function can be found in the Append () method section of jquery .
The 2.html () function can be found in the section of the HTML () method of jquery .

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

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

The difference between the append () function and the HTML () function

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.