Sets the inner HTML of the element, replacing any existing HTML.
The second parameter, append
, is optional. If true
is passed, as in myElement.html('hi', true)
, the HTML is appended instead of replacing existing HTML.
If no arguments are passed, as in myElement.html()
, the element's inner HTML is returned.
示例
语法
html()
html([html], [append])
参数
html
String:
the HTML to be placed inside the element
append
Boolean:
whether to append HTML to existing
Returns
String: the inner HTML of the element
Notice any errors or typos? Please let us know. Please feel free to edit src/dom/dom.js and open a pull request!