Show and hide div onclick button
49,621
You can do this by using jQuery's toggle function like <button class="button" onclick="$('#target').toggle();">Show/Hide</button>
Here is a working example: http://jsfiddle.net/W2vh3/
![Zoker](https://i.stack.imgur.com/R5NJf.png?s=256&g=1)
Author by
Zoker
Updated on December 03, 2020Comments
-
Zoker over 3 years
How can I show and hide a div (content) with a click on a button?
Here some code:
<button class="btn btn-default">Text</button> <div class="div-to-hide">Some content</div>