I'm new to jquery and javascript in general and am having trouble figuring out the difference between these two code sets. This code works:
$(document).ready(function () {
$('div.poem-stanza').addClass('highlight');
});
and this code does not
function x() {
$('div.poem-stanza').addclass('highlight');
}
$(document).ready(x);
giving the error:
Uncaught Typeerror: Object #<Object> has no method 'addclass'
Is there something wrong with my function declaration? BTW, the non-working example comes straight from "Learning JQuery, Third Edition" book.