partial interface Element {
[TreatNullAs=EmptyString] attribute DOMString innerHTML;
[TreatNullAs=EmptyString] attribute DOMString outerHTML;
void insertAdjacentHTML(DOMString position, DOMString text);
};
element . insertAdjacentHTML(position, text)
Parses the given string text as HTML or XML and inserts the resulting nodes into the tree in the position given by the
position argument, as follows:
“beforebegin”
Before the element itself.
“afterbegin”
Just inside the element, before its first child.
“beforeend”
Just inside the element, after its last child.
“afterend”
After the element itself.
Throws a SyntaxError exception if the arguments have invalid values (e.g., in the case of an XML document, if the given string is
not well-formed).
Throws a NoModificationAllowedError exception if the given position isn’t possible (e.g. inserting elements after the root element of a Document).
I highly recommend this book for beginners as well as advanced programmers:
Nguồn: https://midlandlangarseva.com/
Xem thêm bài viết khác: https://midlandlangarseva.com/giai-tri/