Append and innerHTML differences and how to use them

Source: Internet
Author: User
<span id="Label3"><p>1, Append</p><p>How to use append in Jquery: $ ("#id"). append ("<a href= ' # ' >test</a>");</p><p>The action is to append the HTML tag string in append to the end of the matching Element.</p><p>2, InnerHTML</p><p>InnerHTML is the native method of js,<span style="color: #ff0000;">$ ("#id")</span> is a jquery object, jquery does not innerHTML this attribute, it should be written like this <span style="color: #ff0000;">$ ("#id") [0].innerhtml= ""</span> You can get this DOM object using Innerhtml.</p><p>JS can be achieved by document.getElementById ("#id"). InnerHTML = "".</p><p>The action is to change the (internal) HTML of the selected Element.</p><p>Note: $ ("#id"). InnerHTML is meaningless,<span style="color: #111111; line-height: 22px; font-family: Verdana,Arial,Helvetica,sans-serif;">InnerHTML is a property of the DOM Element. </span></p><p>Append and innerHTML differences and how to use them</p></span>

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.