I'm rewriting some stuff which I created with jQuery to vanilla JS. I can't find vanilla JS equivalent for mapping my function to all elements with specified CSS class. For example I have function for slider, in jQuery I'm mapping it like this:
(function($) {
$.fn.slider = function() {
this.each(function() {
// Do some stuff
});
};
$('.slider').slider();
}(jQuery));
What is the propper way to do it in vanilla JS?
document.querySelectorAllordocument.getElementsByClassName, but the latter returns a HTMLCollection so it will not allow you to use NodeList.prototype.forEach().