html - <div> expand on click using Jquery -


i have been surfing internet find answer how make div go down, when clicked on it. have no got it. way, havent got code. thankfull, if give me explanation it.

your question not obvious try answer it.

usually insert divs inside div , set class or element hidden in css. then, when user clicks on div, change css property using js or jquery , set visible.

<html> <head>     <style>      .hidden {         visibility: hidden;     }      .show {         visibility: visible;     }      .blue {         background: blue;         color:white;         heigth:400px;     }     </style>     <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256 hwg4gsxgfzhoseeamdoygbf13fyquitwlaqgxvsngt4="   crossorigin="anonymous"></script> </head>  <div id="parent" class="blue"> click on div     <div id="content" class="hidden">       .... content inside first hidden showed when user        clicks     </div> <div>  <script>  $('#parent').on('click', function () {     $(this).children(':first').toggleclass('show');  });  </script> 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -