I am trying to create a script that when a button is clicked it changes the class of a DIV and then reloads the content of that DIV.
So far I have created a script that successfully changes the class of the DIV.
document.addEventListener("DOMContentLoaded", function (event) {
jQuery("#button").click(function () {
document.getElementById("id").className = "newClass";
});
});
but I still need it to reload the content of the DIV with the new class. I have looked around for a solution and found the following code that I have tried to add:
$("#id").load(window.location.href + " #id");
But gives me the following error:
(index):470 Uncaught TypeError: $ is not a function
What am I doing wrong here?