jQuery
<!DOCTYPE html>
<html lang="en">
<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>Document</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>
<body>
<ul class="one">
<li>test1</li>
</ul>
<ul class="foo">
<li>test2</li>
</ul>
<script type="text/javascript">
jQuery(document.body).css('background-color','yellow');
(function($){
$('ul.foo').click(function(){
$('li',this).css('background-color','red');
});
$('ul.one').click(function(){
$('ul.foo>li').css('background-color','white');
});
})(jQuery)
</script>
</body>
</html>
'컴퓨터 > Javascript' 카테고리의 다른 글
Javascript 드림코딩 by 엘리 (0) | 2022.01.25 |
---|---|
javascript 타이핑 효과 (0) | 2022.01.03 |
javascript 그림슬라이드 (0) | 2021.12.21 |
Javascript Rock's Easyweb (0) | 2021.12.15 |
javascript function 여러개 인수 합 (0) | 2021.09.26 |