Trying to troubleshoot why this code isn't functioning:
https://jsfiddle.net/bv6ort3g/
HTML:
<div class="all-btn">All Button</div>
<div class="item all"> item 1 </div>
<div class="item all"> item 2 </div>
<div class="item all"> item 3 </div>
<div class="item all"> item 4 </div>
<div class="item all"> item 5 </div>
CSS:
.all-btn {
cursor: pointer;
padding: 5px;
border: 1px solid #000;
display: inline-block;
margin-bottom: 15px;
}
.item {
display: none;
}
.show {
display: block;
}
jQuery:
$('.all-btn').on('click', function () {
$('.all').addClass('show');
});
I aim to click the button and have it add the class show to all div elements with the class all
Can anyone point me in the right direction?
Appreciate any help.