Onclick Button, Show & Hide A Div

Share Now

# HTML CODE

<button id="filter-btn">FILTER BUTTON</button>
<div id="newpost">
   <ul>
     <li><a href="">ITEM 1</a></li>
     <li><a href="">ITEM 2</a></li>
     <li><a href="">ITEM 3</a></li>
   </ul>
</div>

# JAVASCRIPT CODE

(function($) {
    "use strict";
// A $( document ).ready() block.
$( document ).ready(function() {

	$("#filter-btn").click(function() {
	    //$("#newpost").toggle();
            $("#newpost").slideToggle();
	});

});
})(jQuery);

# JSFIDDLE LINK

Picture of Nahid Mahamud

Nahid Mahamud

Web Developer | Graphic Designer | WordPress & Woo-commerce Expert