asp.net.ph

Skip Navigation Links

insertAdjacentElement Method

DHTML Methods


Inserts an element at the specified location.

Syntax

object.insertAdjacentElement ( sWhere, oElement ) 
Parameters

sWhere Required. Specifies the position where insert the HTML text is to be inserted. This position can be one of the following:

beforeBegin Inserts the text immediately before the element.
afterBegin Inserts the text after the start of the element but before all other content in the element.
beforeEnd Inserts the text immediately before the end of the element but after all other content in the element.
afterEnd Inserts the text immediately after the end of the element.

oElement Required. Element to be inserted adjacent to the object that invoked the insertAdjacentElement method.

Return Value

No return value.

Example

The following example demonstrates the use of the insertAdjacentElement method to add a new list item to an OL object.

Sample Code

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note