DOM
DOM(Document Object Module)
1. DOM을 이용한 HTML의 객체 불러오기/출력

1-1. console.dir();

2. DOM을 이용한 HTML 값 수정

3. querySelector
Last updated



Last updated
<!DOCTYPE html>
<html>
<head>
<title>Something</title>
<link rel="stylesheet" href="index.css" />
</head>
<body>
<h1 id="title">This works!</h1>
<script src="index.js"></script>
</body>
</html>//HTML을 DOM 객체로 바꿀 수 있음(압축)
const title = document.getElementById("title");
title.innerHTML = "Hi! From JS"; //HTML #title의 값을 Hi! From JS로 바꿀 수 있음const title = document.getElementById("title");
console.dir(document);const title = document.getElementById("title");
title.innerHTML = "Hi! From JS";
title.style.color = "red"; //#title의 텍스트 색을 red로 변경 (따옴표 잊지말자!)
document.title = "I own you now"; //문서명 변경const title = document.querySelector("#title");