Posted by : Unknown
Sabtu, 14 Juli 2018
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<h1>Melki Mitsuki</h1><br>
<div id="div1">gunakan # untuk idi</div>
<div class="div2">gunakan titik untuk class</div>
<div class="div3">ini div3</div>
<div class="div3">ini div3</div>
<div class="div3">ini div3</div>
<div class="div3">ini div3</div>
<script>
$('h1').click(function(){
$('h1').css('color','red');
});
$('#div1').click(function(){
$('#div1').css('color','green');
});
$('.div2').click(function(){
$('.div2').css('color','yellow');
});
$('.div3').click(function(){
$(this).css('color','red');
});
</script>
<h3> kalian dapat mengganti event click dengan mouseenter dan mouseleave</h3>
</body>
</html>