The insertAdjacentElement MethodThe insertAdjacentElement method enables you to insert a new element into a web page. You can see the support for this method in Table 6.29. Table 6.29. The insertAdjacentElement Method
We'll see more about methods such as this one in Chapter 16, where we change web pages on-the-fly . To use this method, you can use the document object's createElement method to create a new element, and then use the insertAdjacentElement to insert the new element next to an existing object. You specify where you want the new element with the position argument, which can take these values:
This method returns the element inserted. |