Skip to Content
자바스크립트 완벽 가이드
book

자바스크립트 완벽 가이드

by David Flanagan, Han Seon- yong
February 2022
Beginner to intermediate
784 pages
24h 53m
Korean
Insight
Content preview from 자바스크립트 완벽 가이드
the De󼴩nitive Guide
507
15.3 문서 스크립트
티에 대응합니다.
className
프로퍼티를 통해 요소의
class
속성을 문자열 형태로
읽고 쓸 수 있습니다. 하지만
class
속성이라는 이름은 적합하지 않습니다. 이 값은
단일 CSS 클래스가 아니라 클래스 리스트이며, 클라이언트 사이드 자바스크립트
프로그래밍에서는 리스트를 문자열로 취급하지 않고 개별 클래스 이름을 추가하거
나 제거할 때가 많습니다.
이 문제를 해결하기 위해 Element 객체에는
class
속성을 리스트로 취급하는
classList
프로퍼티가 있습니다.
classList
프로퍼티의 값은 이터러블인 배열 비슷
한 객체입니다. 프로퍼티 이름이
classList
이긴 하지만 이 프로퍼티는 클래스 세트
에 더 가깝게 동작하며,
add()
,
remove()
,
contains()
,
toggle()
메서드가 있습니다.
//
모래시계를
써서
사용자에게
현재
작업
중임을
알립니다
.
//
이를
위해
hidden
클래스를
제거하고
animated
클래스를
추가합니다
.
let spinner
=
document.querySelector("#spinner");
spinner.classList.remove("hidden");
spinner.classList.add("animated");
󺠿󻱃󼗿󻘚󽴔󻙜󻘀
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

코드로 인프라 관리하기(2판)

코드로 인프라 관리하기(2판)

키프 모리스

Publisher Resources

ISBN: 9788966263462