I\'m trying to do something very simple. Basically I have a clickable div \'hot spot\', when you click that it fills the screen and displays some content. I achieved this by
Use .on()
you need event delegation as these classes are not present on DOM when DOM is ready.
$(document).on("click", ".clickable", function () {
$(this).addClass("grown");
$(this).removeClass("spot");
});
$(document).on("click", ".close_button", function () {
$("#spot1").removeClass("grown");
$("#spot1").addClass("spot");
});