I have a global variable "theClass" that I try to assign the contents of a DOM element after a click event has occurred, then I try to use it on another page, but it's not even being assigned in the first place! This' the code, that returns ' false' in the console. I'm using jQuery.
var theClass = '';
var getCategories = false;
$(document).ready(function(){
$(document).on("click", ".nav li a", function() {
theClass = $(this).html();
getCategories = true;
});
console.log(theClass+" "+getCategories);
});