-
JS로 HTML Style다루기JavaScript/DOM 2023. 1. 29. 20:31
style 프로퍼티
element.className
element.classList
add 클래스 추가하기 remove toggle contains replace <!DOCTYPE html> <html lang="ko"> <head> <meta charset="UTF-8">v <title>JS with Codeit</title> <style> .done { opacity: 1; text-decoration: line-through; } </style> </head> <body> <div> <h1 class="title">오늘 할 일</h1> <ol id="today" class="list today"> <li class="item">자바스크립트 공부</li> <li class="item">고양이 화장실 청소</li> <li class="item">고양이 장난감 쇼핑</li> </ol> <h1 class="title">내일 할 일</h1> <ol id="tomorrow" class="list tomorrow"> <li class="item">자바스크립트 공부</li> <li class="item">뮤지컬 공연 예매</li> <li class="item">유튜브 시청</li> </ol> </div> <script src="./index.js"></script> </body> </html>
'JavaScript > DOM' 카테고리의 다른 글
getAttribute(), setAttritube(), removeAttribute() (0) 2023.01.28 innerHTML, outerHTML, textContent, innerText (0) 2023.01.28 <script>태그 위치 (0) 2023.01.11 DOM조작 (0) 2022.11.26 DOM - 노드 (0) 2022.11.26