Adjacent DOM Manipulation



In addition to all the other DOM manipulation techniques that I have show in previous videos about JavaScript in the Browser, there are three that allow you to target specific locations around any HTML element.
Element.insertAdjacentHTML(position, HTMLString)
Element.insertAdjacentElement(position, Element)
Element.insertAdjacentText(position, text)

The position value in all three methods is one of the following values:
beforebegin
afterbegin
beforeend
afterend

Code GIST:

Nguồn: https://dinhk.net/

Xem thêm bài viết: https://dinhk.net/category/giai-tri/

Category
Tags
No Tag

Leave a Reply

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