DOM
-
5주차 강의이노베이션 캠프/2주차_자바스크립트_문법 2023. 6. 17. 21:32
DOM (Document Object Model) Document(html 파일)를 JS가 알아먹을 수 있는 Object형태로 Modellng 한 것 최상위 노드: document 브라우저에 기본적으로 내장, 브라우저 환경에서만 돌아감 브라우저 환경: 확인 가능 node 환경: 확인 불가능 (ex: vscode) 브라우저의 요소들에 접근하고 조작하는 방법을 제공 속성: 객체의 상태나 특징을 나타내는 값을 저장하는 변수 (예: a.id) 메소드: 객체가 수행할 수 있는 동작이나 기능을 나타내는 함수 // 접근 // id 값에 해당하는 요소에 접근하여 값을 반환 document.getElementById("id"); // class 값에 해당하는 요소에 접근하여 값을 반환 document.getElement..