I have a button to toggle a class to hide and show when a button is clicked.
My problem is a toggle only works for one specific element. It wont work for multiple classes / or ID's. I have a @foreach loop that loops through blogs, and on click, I need the div to be hidden, but all those foreach loops generate the same ID.
This is what I have right now:
 <button class="btn btn-primary">Preview</button> <br />
@foreach($blog as $b)
  <div class="col-md-12" class="toggleButtonsFeatured">
    some text here....
  </div>
@endforeach
 <script>
        $( "button" ).click(function() {
            $(".toggleButtonsFeatured").toggleClass(); 
        });
 </script>   
How would I toggle all those dynamically produced div's at once?
 
     
    