티스토리 뷰

DOM with JS
[index.html]
<!DOCTYPE html>
<html>
<head>
<title>Sample</title>
<link rel="stylesheet" href="index.css" />
</head>
<body>
<h1 id="title">This works!</h1>
<script src="index.js"></script>
</body>
</html>
[index.js]
const title = document.getElementById("title");
title.innerHTML = "Hi from js"; // title의 내용이 바뀐다.
console.dir(title);
console.dir(title);

console.dir(title); 를 입력하면 title객체의 property를 전부 확인 할수있다.
'노마드코더 > Vanilla JS' 카테고리의 다른 글
#2-5 첫번째 조건문!! If, else, and, or (0) | 2021.08.28 |
---|---|
#2-4 Events and event handlers (0) | 2021.08.28 |
#2-2 JS DOM Functions (0) | 2021.08.28 |
#2-1 너의 첫번째 함수! (Your first JS Function) (0) | 2021.08.28 |
#1-10 Organizing Data with Objects (0) | 2021.08.28 |