đź–‹️DOM

 

Travail personel sur le DOM

Property / MethodDescription
element.appendChild()Adds a new child node, to an element, as the last child node
element.attributesReturns a NamedNodeMap of an element's attributes
element.childElementCountReturns the number of child elements an element has
element.childNodesReturns a collection of an element's child nodes (including text and comment nodes)
element.childrenReturns a collection of an element's child element (excluding text and comment nodes)
element.classListReturns the class name(s) of an element
element.classNameSets or returns the value of the class attribute of an element
element.cloneNode()Clones an element
element.contains()Returns true if a node is a descendant of a node, otherwise false
element.contentEditableSets or returns whether the content of an element is editable or not
element.firstChildReturns the first child node of an element
element.firstElementChildReturns the first child element of an element
element.getAttribute()Returns the specified attribute value of an element node
element.getAttributeNode()Returns the specified attribute node
element.getElementsByClassName()Returns a collection of all child elements with the specified class name
element.getElementsByTagName()Returns a collection of all child elements with the specified tag name
element.hasChildNodes()Returns true if an element has any child nodes, otherwise false
element.idSets or returns the value of the id attribute of an element
element.innerHTMLSets or returns the content of an element
element.insertBefore()Inserts a new child node before a specified, existing, child node
element.lastChildReturns the last child node of an element
element.lastElementChildReturns the last child element of an element
element.nextSiblingReturns the next node at the same node tree level
element.nextElementSiblingReturns the next element at the same node tree level
element.nodeNameReturns the name of a node
element.nodeTypeReturns the node type of a node
element.nodeValueSets or returns the value of a node
element.parentNodeReturns the parent node of an element
element.parentElementReturns the parent element node of an element
element.previousSiblingReturns the previous node at the same node tree level
element.previousElementSiblingReturns the previous element at the same node tree level
element.querySelector()Returns the first child element that matches a specified CSS selector(s) of an element
element.querySelectorAll()Returns all child elements that matches a specified CSS selector(s) of an element
element.removeAttribute()Removes a specified attribute from an element
element.removeChild()Removes a child node from an element
element.replaceChild()Replaces a child node in an element
element.setAttribute()Sets or changes the specified attribute, to the specified value
element.setAttributeNode()Sets or changes the specified attribute node
element.styleSets or returns the value of the style attribute of an element
element.tagNameReturns the tag name of an element
element.textContentSets or returns the textual content of a node and its descendants
nodelist.item()Returns the node at the specified index in a NodeList
nodelist.lengthReturns the number of nodes in a NodeList