DOM

skang6283·2021년 1월 31일
0

Document Object Model

  • allows use to interface javascript code to interact with HTML & CSS
document +
.getElementById()Returns the elemnt with the id
getElementByClassName()Returns list of all elements belonging to a class
getElementsByTagName()Returns list of all elements with the tag
querySelector()Returns the first object matching the CSS style selector
querySelectorAll()Returns all objects matching the CSS style selelctor

var myvariable = document.querySelector()
myvariable +
.textContextreturns just the text
.innerHTMLreturns the actual html
.getAttribute()returns the original attribute
.setAttribute()set an attribute
.addEventListner(event,function())add listener that execute function() upon specified event

For more info,
https://developer.mozilla.org/en-US/

profile
Hi :) I'm Max

0개의 댓글