Gets the HTML content of the first matching element, which cannot be used in an XML document, but can be used in an XHTML document, and in an HTML document we can use the. html () method to get the contents of any element. If the selector matches more than one element, only the HTML content of the first matching element is fetched, equivalent to the innerHTML in JavaScript, readable and writable, and HTML tags can be parsed
If callback is passed in, this function returns a string and the parameters are resolved as follows:
1.index is the index position of the element in the collection
2.html is the original HTML value.
Instance:
<! DOCTYPE html>Div{font:25px/250px ' Courier New '; Text-align:center;color: #000; border:1px solid #F50; width:700px;height:250px;margin : 20px Auto;} . addone{padding:08px;} . addtwo{color:#999;}</style><script type= ' Text/javascript ' > $(function() {alert ($ (' #user '). HTML ()); $(' #user '). HTML (' <strong>this is a test</strong> '); });</script> [jquery method HTML ([VAL|FN])] This method operates on a matching element or content in an element set, equivalent to innerHTML in JavaScript