How do I “toggle all”, and also toggle specific classes of elements?
问题 I want to toggle the visibility of classes of list items and also toggle the visibility of all the list items. With help of another stack overflow post, I am able to toggle specific classes of list items. Here's the Javascript I have that toggles specific classes of list items: var switcher = [false, false, false]; var classes = ['easy', 'fun', 'silly']; $('.toggler').click(function () { var x = $(this).hasClass('checked'); switcher[$(this).data('switch')] = !x; $(this).toggleClass("checked",