Which JavaScript method is used to add a new HTML element to the DOM?

2025

Which JavaScript method is used to add a new HTML element to the DOM?

Answer: B. createElement()In JavaScript, document.createElement() is used to create a new HTML element in the DOM.

  1. A.

    appendElement()

  2. B.

    createElement()

  3. C.

    newElement()

  4. D.

    addElement()

Attempted by 58 students.

Show answer & explanation

Correct answer: B

In JavaScript, document.createElement() is used to create a new HTML element in the DOM.

Explore the full course: Uppsc Polytechnic Lecturer 2025 Cs

Loading lesson…