Question
I'm getting script.js:2 Uncaught ReferenceError: $ is not defined i;m stuck // Set the date at the top of the page $(#currentDay).currentTime(moment().format(dddd, MMMM Do)); //
I'm getting "script.js:2 Uncaught ReferenceError: $ is not defined" i;m stuck
// Set the date at the top of the page
$("#currentDay").currentTime(moment().format("dddd, MMMM Do"));
// Set the status of each time-block
$(".time-block").each(function() {
var currentTime = moment().hours();
var timeBlock = parseInt($(this).attr("id").split("-")[1]);
if (timeBlock < currentTime) {
$(this).addClass("past");
} else if (timeBlock === currentTime) {
$(this).addClass("present");
} else {
$(this).addClass("future");
}
});
// Load any saved data from localStorage
$(".description").each(function() {
var timeBlock = $(this).parent().attr("id");
var savedData = localStorage.getItem(timeBlock);
if (savedData) {
$(this).val(savedData);
}
});
// Save the data to localStorage on click
$(".saveBtn").on("click", function() {
var timeBlock = $(this).parent().attr("id");
var description = $(this).siblings(".description").val();
localStorage.setItem(timeBlock, description);
});
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started