Jump to content

baghel23

New Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by baghel23

  1. To create DOM nodes, there are two methods:

    document.createElement(tag)

    Creates a new element node with the given tag:

    let div = document.createElement('div');
    document.createTextNode(text)

    Creates a new text node with the given text:

    let textNode = document.createTextNode('Here I am');

    Most of the time we need to create element nodes, such as the div for the message.

×
×
  • Create New...