mardi 16 juin 2015

Random quote page reload javascript

I am attempting to have the page reload with a different message in each part. I thought I had it perfectly but cannot figure out why it isn't showing exactly.

In my javascript console it says Uncaught ReferenceError: $ is not defined

but here is the code

Html

<div id="words"></div>

And here is the Javascript

var words = new Array();
words[0] = " loves you";
words[1] = "Would you like  to tuck you in?";
words[2] = " is here for you";
words[3] = "Did you know that  can be in 2 places at once?";
var random = Math.ceil (Math.random()*words.length) - 1;
$('words').set('html', words[random]);




Aucun commentaire:

Enregistrer un commentaire