I am trying to make a life simulator (web-based) with JavaScript and jQuery and when I took the code and ran it, the console said ReferenceError: '$' is not defined at /code.js 10:1
The jQuery $
worked before I added this: $('#name').html(name);
I don't know what the problem is. This is my code:
var name = prompt('What is your name?');
var money = 1000;
var hunger = 100;
var hygiene = 100;
var sleep = 100;
var favColor = prompt('What is your favorite color?\nIf there is 2 words, combine them.\nDo not capitalize the color.', 'green');
var start = true;
$('#name').html(name);
$('#color').css('color', favColor);
function bed() {
$('#bed').html('You are sleeping');
var sleeping = setInterval(function() {
if (sleep == 100) {
this.clearInterval();
$('#bed').html('You are awake');
} else {
sleep++;
}
}, 500);
}