Search

_0206_querySelectorAll로변경

대분류
STEP02 속성변경
소분류
속성변경

영상

개념

<!DOCTYPE html> <html lang="ko"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>querySelectorAll()</title> </head> <body> <p class="content">querySelectorAll() 메서드1</p> <p class="content">querySelectorAll() 메서드2</p> <script> // 태그 선택 let list = document.querySelectorAll("p.content"); for(let i=0; i<list.length; i++) { // 텍스트 굵기 변경 list[i].style.fontWeight = "bold"; } </script> </body> </html>
Java
복사