I get this error message in the console log:
Uncaught TypeError: $ is not a function
It references the following line: $('.bericht').append(themessage);
This is my full JS file:
var thehours = new Date().getHours();
var theminutes = new Date().getMinutes();
var themessage;
var open = ('nu open');
var gesloten = ('nu gesloten');
if (thehours === 9 && theminutes >= 30) { // 09:30 - 10:00 open
themessage = open;
} else if (thehours >= 10 && thehours < 18) { // 10:00 - 18:00 open
themessage = open;
} else { // when we are not open - we are closed :)
themessage = gesloten;
}
$('.bericht').append(themessage);
var thehours1 = new Date().getHours();
var theminutes1 = new Date().getMinutes();
var themessage1;
var open1 = ('09.30 - 18.00');
var gesloten1 = ('18.00 - 09.30');
if (thehours1 === 9 && theminutes1 >= 30) { // 09:30 - 10:00 open
themessage1 = open1;
} else if (thehours1 >= 10 && thehours1 < 18) { // 10:00 - 18:00 open
themessage1 = open1;
} else { // when we are not open - we are closed :)
themessage1 = gesloten1;
}
$('.bericht1').append(themessage1);
In my html site, the Javascript works perfectly and depending on the time of day I get a different message, but in my Wordpress site neither message appears.
Any idea why this is and what I can do to make it work?
Many thanks.