The following code sucessfully targets all elements with .btn
class.
$(".btn").toggleClass("pressed");
Meanwhile, this returns the first element with .btn class.
$(".btn")[0];
But why $(".btn")[0].toggleClass("pressed");
doesn’t work and return “.toggleClass is not a function in console.”?