※ removeClass() 사용
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("h1, h2, p").removeClass("blue");
});
});
</script>
<style>
.blue {
color: blue;
}
</style>
</head>
<body>
<h1 class="blue">Heading 1</h1>
<h2 class="blue">Heading 2</h2>
<p class="blue">This is a paragraph.</p>
<p>This is another paragraph.</p>
<button>Remove class from elements</button>
</body>
</html>
※ 실행화면
'jQuery 수업' 카테고리의 다른 글
jQuery-15(add적용 - before(), after()) (0) | 2020.02.20 |
---|---|
jQuery-17(addClass()사용) (0) | 2020.02.19 |
jQuery-16(remove()사용) (0) | 2020.02.19 |
jQuery-14(add적용 - append()) (0) | 2020.02.19 |
jQuery-13(set적용-attr()) (0) | 2020.02.19 |