. 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 ()