The similarities and differences between HTML and. Text

Source: Internet
Author: User

    1. The. Html method operation is the same as the. text, except that it is specific to the processing object
    2. . HTML handles the content of elements,. Text handles textual content
    3. . HTML can only be used in HTML documents, and. Text can be used in both XML and HTML documents
    4. If the object you are working with has only one child text node, the result of HTML processing is the same as text.
    5. Firefox does not support the InnerText property, using a similar textcontent property, the. Text () method combines support for 2 properties, so it can be compatible with all browsers

    1. . HTML () does not pass in a value, which is the HTML content that gets the first matching element in the collection
    2. . HTML (htmlstring) sets the HTML content of each matching element
    3. . HTML (function (index, oldhtml)) is used to return a function that sets HTML content
The. htm () method is used internally by the DOM's innerHTML property to handle, so one of the most important issues to be aware of in terms of Setup and acquisition is the entire HTML content (not just text content)
    1. . Text () Gets the merged text of each element in the matching element collection, including their descendants
    2. . Text (TextString) used to set the content of matching elements
    3. . text (function (index, text)) is used to return a function that sets the text content

The. Text () result returns a string containing the merged text for all matching elements

The similarities and differences between HTML and. Text

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.