![]() Var text = document.createTextNode('Y HALO THAR') In your code example: var div = document.createElement('div') If there is text in the innerHTML you set, then text nodes will be created to hold it.ĭOCUMENT_NODE, ELEMENT_NODE and TEXT_NODE are the most common node types and are in every page that has text. innerHTML property of an element node, it creates the appropriate nodes and makes them child nodes of the element that you set the innerHTML property on. Those child nodes can be other ELEMENT nodes or they can be TEXT nodes or COMMENT nodes or other types of nodes. For example, a div is an ELEMENT node which can contain child nodes. The page consists of a number of different types of nodes (you can see a listing of the different node types here: ), some of which can have child nodes and some of which cannot. All viewable HTML text in a page (except text in form elements or custom embedded objects) is in text nodes.
0 Comments
Leave a Reply. |