Search completed in 2.57 seconds.
4 results for "insertAdjacentElement":
Element.insertAdjacentElement() - Web APIs
WebAPIElementinsertAdjacentElement
the insertadjacentelement() method of the element interface inserts a given element node at a given position relative to the element it is invoked upon.
... syntax targetelement.insertadjacentelement(position, element); parameters position a domstring representing the position relative to the targetelement; must match (case-insensitively) one of the following strings: 'beforebegin': before the targetelement itself.
... example beforebtn.addeventlistener('click', function() { var tempdiv = document.createelement('div'); tempdiv.style.backgroundcolor = randomcolor(); if (activeelem) { activeelem.insertadjacentelement('beforebegin',tempdiv); } setlistener(tempdiv); }); afterbtn.addeventlistener('click', function() { var tempdiv = document.createelement('div'); tempdiv.style.backgroundcolor = randomcolor(); if (activeelem) { activeelem.insertadjacentelement('afterend',tempdiv); } setlistener(tempdiv); }); have a look at our insertadjacentelement.html demo on github (see the source code too.)...
...And 2 more matches
Element - Web APIs
WebAPIElement
element.insertadjacentelement() inserts a given element node at a given position relative to the element it is invoked upon.
... living standard added the following methods: closest(), insertadjacentelement() and insertadjacenttext().
Index - Web APIs
WebAPIIndex
1128 element.insertadjacentelement() api, dom, element, gecko, method, reference, insertadjacentelement the insertadjacentelement() method of the element interface inserts a given element node at a given position relative to the element it is invoked upon.
XMLSerializer - Web APIs
WebAPIXMLSerializer
note: in the real world, you should usually instead call importnode() method to import the new node into the dom, then call one of the following methods to add the node to the dom tree: the document and element methods append() and prepend() the node.replacewith() method (to replace an existing node with the new one) the document.insertadjacentelement() and element.insertadjacentelement() methods.