html()
Get the html content of the first matching element. This function cannot be used with XML documents. But it can be used for XHTML documents.
Get the html contents of the first matched element. This property is not available on XML documents (although it will work for XHTML documents).
Return value
String
Example
HTML code:
< p>Hello
jQuery code:
$("div").html();
Result:
Hello
html(val)
Set the html content of each matching element. This function cannot be used with XML documents. But it can be used for XHTML documents.
Set the html contents of every matched element. This property is not available on XML documents (although it will work for XHTML documents).
Return value
jQuery
Parameters
val (String): Value used to set HTML content
Example
HTML code:
jQuery code:
$("div").html("
Hello Again
Result:
[
]