code
ref
Cheat Sheets
Quick Reference
JSON Formatter
Learn
Tools
Browser Support
Search…
Ctrl K
Cheat Sheets
/
Web
/
HTML DOM
HTML DOM
Document, Element, Node, Event and Window APIs for scripting web pages.
Official reference ↗
Document
Query
getElementById()
querySelector()
querySelectorAll()
getElementsByClassName()
getElementsByTagName()
getElementsByName()
Create
createElement()
createTextNode()
createDocumentFragment()
createComment()
importNode()
adoptNode()
Properties
body
head
title
documentElement
cookie
readyState
activeElement
forms
images
links
URL
referrer
Element
Attributes
getAttribute()
setAttribute()
removeAttribute()
hasAttribute()
toggleAttribute()
attributes
Classes & Content
id
className
classList
innerHTML
outerHTML
insertAdjacentHTML()
insertAdjacentElement()
setHTMLUnsafe()
Tree
children
firstElementChild
lastElementChild
nextElementSibling
previousElementSibling
closest()
matches()
append()
prepend()
before()
after()
remove()
replaceWith()
replaceChildren()
Geometry & Scroll
getBoundingClientRect()
scrollIntoView()
scrollTop
scrollLeft
scrollHeight
clientWidth
clientHeight
scrollTo()
Other
attachShadow()
shadowRoot
requestFullscreen()
animate()
setPointerCapture()
HTMLElement
dataset
style
hidden
innerText
title
tabIndex
contentEditable
offsetWidth
offsetHeight
offsetTop
offsetLeft
offsetParent
focus()
blur()
click()
showPopover()
hidePopover()
Node
Methods
appendChild()
removeChild()
replaceChild()
insertBefore()
cloneNode()
contains()
hasChildNodes()
normalize()
isEqualNode()
compareDocumentPosition()
Properties
childNodes
firstChild
lastChild
parentNode
parentElement
nextSibling
previousSibling
nodeName
nodeType
nodeValue
textContent
ownerDocument
isConnected
Events
EventTarget
addEventListener()
removeEventListener()
dispatchEvent()
Event
preventDefault()
stopPropagation()
stopImmediatePropagation()
target
currentTarget
type
bubbles
cancelable
defaultPrevented
timeStamp
isTrusted
Constructors
Event
CustomEvent
MouseEvent
KeyboardEvent
PointerEvent
InputEvent
FocusEvent
SubmitEvent
Event Types
Element
click
dblclick
contextmenu
mousedown
mouseup
mousemove
mouseenter
mouseleave
pointerdown
pointerup
keydown
keyup
focus
blur
focusin
focusout
scroll
wheel
input
Others
change
submit
DOMContentLoaded
visibilitychange
load
resize
beforeunload
hashchange
popstate
storage
Window
Dialogs & Timers
alert()
confirm()
prompt()
open()
close()
setTimeout()
setInterval()
clearTimeout()
clearInterval()
requestAnimationFrame()
queueMicrotask()
Other
fetch()
getComputedStyle()
matchMedia()
scrollTo()
scrollBy()
structuredClone()
postMessage()
localStorage
sessionStorage
location
history
navigator
innerWidth
innerHeight
devicePixelRatio
scrollY
Location & History
Location
href
origin
pathname
search
hash
host
reload()
assign()
replace()
History
back()
forward()
go()
pushState()
replaceState()
state
length
Storage
getItem()
setItem()
removeItem()
clear()
key()
length
DOMTokenList (classList)
add()
remove()
toggle()
contains()
replace()
Observers & Utilities
MutationObserver
IntersectionObserver
ResizeObserver
DOMParser
XMLSerializer
FormData
URLSearchParams
AbortController
TreeWalker
Range
Selection