Difference between revisions of "Btndisplay"

From rbachwiki
Jump to navigation Jump to search
(Created page with "=Hide and show certain products with a button= ==HTML== <pre> <div id="filters"> <button id="filter-berry">Toggle berry flavors</button> <!-- <button id="filter-citrus">Toggle...")
 
 
Line 15: Line 15:
     });
     });
</pre>
</pre>
[[#top|Back To Top]]<  —  >[[JQuery|Category]]<  —  >[[Main_Page| Home]]

Latest revision as of 23:06, 26 December 2016

Hide and show certain products with a button

HTML

<div id="filters">
<button id="filter-berry">Toggle berry flavors</button>
<!-- <button id="filter-citrus">Toggle citrus</button> -->
</div>

JQuery

 $('#filter-berry').click(function(e) {
        e.preventDefault();
        $('#cart-water').find('.berry').slideToggle(500);
    });

Back To Top< — >Category< — > Home