- HTML is the same as the. Text method, except that it is specific to the processing object.
- HTML handles the content of the element, and. Text handles the 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 (),. Text (),. Val () Three methods are used to read the contents of the selected element; HTML () is used to read elements of the HTML content (including HTML tags),. Text () is used to read the plain text content of an element, including its descendant elements,. Val () Is the "value" value that is used to read form elements. where the. html () and. Text () methods cannot be used on form elements, whereas. val () can only be used on form elements, and the. html () method only reads the first element when used on more than one element; the. val () method is the same as. html () If it is applied on more than one element. Only the value of the first FORM element can be read, but. Text () is different from theirs, and if. Text () is applied on more than one element, the textual content of all the selected elements is read.
- . HTML (htmlstring),. Text (TextString), and. Val (value) Three methods are used to replace the contents of the selected element, and if three methods are applied on more than one element at the same time, the contents of all the selected elements will be replaced.
- . HTML (),. Text (),. Val () can use the return value of the callback function to dynamically change the contents of multiple elements.
In JQ. html (),. Text () and. Val () Summary