javascript5 [javascript] html in javascript, searching for element javascript는 html에 연결 돼 있어 접근 할 수 있다 javascript에서 html 항목을 보고 접근 할 수 있다 html 항목을 id로 들고올 수 있다. getElementById() 그러나 id를 잘 쓰지 않는다. 보통 클래스name을 쓰거나 id와 클래스 네임을 같이 쓴다 이럴 때 getElementByClassName을 쓰면 같은 classname을 가지는 항목들을 array로 저장 하고 getElementByTagName은 h1, class, button 등과 같은 항목을 가져 온다 가장 추천 하는 방법은 querySelector. 이건 css 방식으로 항목을 가져 올 수 있는데 const title = document.querySelector(".hello h1"); class h.. 2021. 8. 13. 이전 1 2 다음