
더보기
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1 class="heading">DOM 조작</h1>
<a href="https://www.google.com/">google</a>
<p class="content">content1</p>
<p class="content">content2</p>
<p class="content">content3</p>
<ul>
<li>list1</li>
<li>list2</li>
</ul>
<script>
const h1Tag = document.querySelector('.heading')
console.log(h1Tag)
console.log(h1Tag.textContent)
h1Tag.textContent = '내용 수정'
console.log(h1Tag.textContent)
</script>
</body>
</html>

![]() |
![]() |
![]() |
![]() |
'WEB > JavaScript' 카테고리의 다른 글
| [JavaScript][DOM 조작] 5. style 조작 (0) | 2024.04.16 |
|---|---|
| [JavaScript][DOM 조작] 4. DOM 요소 조작 (0) | 2024.04.16 |
| [JavaScript][DOM 조작] 2. 속성 조작 (일반 속성) (0) | 2024.04.16 |
| [JavaScript][DOM 조작] 1. 속성 조작 (클래스 속성) (0) | 2024.04.16 |
| [JavaScript][DOM 조작] 0. 전체 종류 (0) | 2024.04.16 |



