JavaScript Tutorial – insertAdjacentHTML

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:
Before the element itself.

Just inside the element, before its first child.

Just inside the element, after its last child.

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:


Xem thêm bài viết khác:

Article Categories:
Giải Trí

Leave a Reply

Your email address will not be published. Required fields are marked *