HTML InnerHTML, Textcontext, InnerText

Source: Internet
Author: User

Website: Https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML

1.innerHTML: Gets or modifies the content of the element in the HTML language. This property allows you to execute some JS code. Non-standard.

The correspondence between some symbols and the left entity:

1) &quot: "

2) &lt: <

3) &GT: >

4) &amp: &

5): Space

If you set the contents of an element with innerHTML:

1) A single "<", if there is no paired ">", will Cause "<" after the content can not be resolved, all ignored.

2) The pairing of the "<" and ">" and between the contents, if not the legal label, will cause the illegal label to be ignored.

3) The entity of HTML in innerHTML text content will be converted to the corresponding symbol display first.

2.textContent: Can correctly get the node content, there will be no special symbol of the problem.

3.innerText: Non-standard attribute that gets the text of the node and its child nodes.

HTML InnerHTML, Textcontext, InnerText

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.