So what im trying to do here is to show and hide div when i click button but it does not work and i dont know why.
script $(document).ready(function(){ $('article').addClass("hidden"); $('#hide').click(function() { var $this = $(this); if ($this.hasClass("hidden")) { $(this).removeClass("hidden").addClass("visible"); } else { $(this).removeClass("visible").addClass("hidden"); } }); }); Here is CSS
.hidden>div { display: none; } .visible>div { display: block; } Here is HTML
<article> <button type="button" id="hide"></button> <div> <img /> <img /> </div> </article>