Iterating through a collection of elements like you would with a linq statement in C#
//If you query with document.querySelectorAll, it always returns a collection.
var toggleButtons = document.querySelectorAll('.toggle-publications');
// Iterate through each element in the collection by setting the element in the parameter (x)
// the below remoes every item in the collection
toggleButtons.forEach(function (x) { x.remove(); })