jquery properties and Styles ——. html () and. Text ()

Source: Internet
Author: User

. HTML () and. Text ()

1. HTML and. Text for reading the HTML structure or text content of the modified element

2. HTML () Gets the HTML content of the first matching element in the collection or sets the HTML content of each matching element

3 Ways to 3.html ()

. HTML () does not pass in the value, only gets the HTML content of the first matching element in the collection

. HTML (htmlstring) sets the HTML content of each matching element

. html (function (index,oldhtml)) returns one by one functions that set HTML content

4. The HTML () method uses the DOM's innerHTML property for processing, so it's not just text content for the entire HTML content

5. Text () to match the textual content of each element in the collection of elements (including their descendants) or set the text content of each element in the matching element collection to the specified text content

6. Text () is available in 3 ways

. Text () Gets the merged text of each element in the matching element collection, including their descendants

. Text (TextString) used to set the content of matching elements

. text (function (index,text)) is used to return a function that sets the text content

7. Text () result returns a string that includes the merged text of all matching elements

8. HTML differs from. Text

. HTML handles the content of elements,. Text handles textual content

. HTML can only be used in HTML documents, and. Text can be used in both XML and HTML documents

Firefox does not support the InnerText property, uses a similar textcontent property, and. Text can be compatible with all browsers

8 . html and the same point as. Text

The . HTML is the same as the. Text method, except that it is specific to the processing object.

HTML and text handle only one child text node, the result is the same

jquery properties and Styles ——. html () and. Text ()

Related Article

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.