Skip to content

Instantly share code, notes, and snippets.

@asathoor
Created March 11, 2019 09:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asathoor/4fd4c121e747cff9583e0948ce3350ea to your computer and use it in GitHub Desktop.
Save asathoor/4fd4c121e747cff9583e0948ce3350ea to your computer and use it in GitHub Desktop.
jquery y-class
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){ // dom load check
// hat click detector
$("#hat").click(function(){
$('#evilla').toggle();
$('.star').toggle();
});
// my code ends
}); // document ready ends
</script>
</head>
<body>
<h2>One dark evening</h2>
<p>Transparent clouds pass the moon. Werewolves are howling</p>
<p>Just another manic monday.</p>
<img id="evilla" src="images/witch.png" alt="Evilla the evil bitch">
<img class="star" src="images/star.png" alt="star">
<img class="star" src="images/star.png" alt="star">
<img class="star" src="images/star.png" alt="star">
<img class="star" src="images/star.png" alt="star">
<img class="star" src="images/star.png" alt="star">
<img id="hat" src="images/hat.png" alt="hat">
<button>Click me to hide paragraphs</button>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment