jQuery effects – Show(), Hide(), Toggle()

jQuery effects effects that can be added to parts of a web page using the jQuery library. These effects include fading, sliding, hiding, showing, fadeIn, slideUp, animate and more.

  • Show()
  • Hide()
  • Toggle()
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<!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>
<style>
div{
width: 120px;
height: 120px;
background-color: blue;
}
</style>
</head>
<body>
<!-- show
hide
Toggle -->
<div></div>
<button class="show">Show</button>
<button class="Hide">Hide</button>
<button class="Toggle">Toggle</button>
<script src="jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function(){
$(".show").click(function(){
$("div").show()
})
$(".Hide").click(function(){
$("div").hide()
})
$(".Toggle").click(function(){
$("div").toggle()
})
});
</script>
</body>
</html>
<!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> <style> div{ width: 120px; height: 120px; background-color: blue; } </style> </head> <body> <!-- show hide Toggle --> <div></div> <button class="show">Show</button> <button class="Hide">Hide</button> <button class="Toggle">Toggle</button> <script src="jquery-3.6.0.min.js"></script> <script> $(document).ready(function(){ $(".show").click(function(){ $("div").show() }) $(".Hide").click(function(){ $("div").hide() }) $(".Toggle").click(function(){ $("div").toggle() }) }); </script> </body> </html>
<!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>
    <style>

        div{
            width: 120px;
            height: 120px;
            background-color: blue;

        }
    </style>
</head>
<body>

    <!-- show
         hide
         Toggle -->
      <div></div>  
      <button class="show">Show</button> 
      <button class="Hide">Hide</button> 
      <button class="Toggle">Toggle</button> 

      <script src="jquery-3.6.0.min.js"></script>
      <script>
$(document).ready(function(){

$(".show").click(function(){
    $("div").show()
})
$(".Hide").click(function(){
    $("div").hide()
})
$(".Toggle").click(function(){
    $("div").toggle()
})
 });   
      </script>
</body>
</html>

 

Tags: Show(), Hide(), Toggle(), jquery effects, jquery effects tutorials, jquery, jquery code snippets

MIT license