강의

멘토링

커뮤니티

Inflearn Community Q&A

sanghyeok5555's profile image
sanghyeok5555

asked

JavaScript+jQuery from Basics to Practice: Intermediate Part.2

Lab - Setting Style with jQuery

섹션 0. 실습 - jQuery를 활용한 스타일 값 설정하기 - ex11 中

Written on

·

226

0

$jQuery.removeClass() 메서드를 사용해 노드의 class 속성을 제거하는 실습입니다.
 
$(".menu li").each(function(){ //루핑하면서 선택된 li객체의 모든 클래스를 제거하고 있다. $(this).removeClass(); });
 
ul.menu의 자식 요소들인 li 요소의 클래스를 제거하기 위해서
each() 메서드를 사용하지 않아도 가능합니다.
 
$("#remove").on("click", function() {
                // $content.children().removeClass();
                $(".menu li").removeClass();
            });
위 코드로도 .menu li의 클래스를 삭제할 수 있습니다.
 
 
 
jqueryjavascript

Answer

This question is waiting for answers
Be the first to answer!
sanghyeok5555's profile image
sanghyeok5555

asked

Ask a question