- The. Html method operation is the same as the. text, except that it is specific to the processing object
- . 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
- If the object you are working with has only one child text node, the result of HTML processing is the same as text.
- 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
- . HTML () does not pass in a value, which is the HTML content that gets the first matching element in the collection
- . HTML (htmlstring) sets the HTML content of each matching element
- . 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)
- . 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
The. Text () result returns a string containing the merged text for all matching elements
The similarities and differences between HTML and. Text