How to convert jQuery code to Pure JavaScript code?
I'd like to convert jQuery to Pure JavaScript but it doesn't work. jQuery: (document).ready(function() { $(".js-all-btn").on("click", this, function() { $(this).toggleClass("active"); $(".js-all-content").toggleClass("a-block"); } ); }); To Pure: document.addEventListener("DOMContentLoaded", function() { document.querySelector(".js-all-btn").on("click", this, function() { document.querySelector(this).toggleClass("active"); document.querySelector(".js-all-content").toggleClass("a-block"); }); }); Result: document.querySelector(...).on is…