Adding content with jQuery
Hi
I've been given the following code (from a book on jQuery) that should add content to the page:
$('<div>', {
id: 'specialButton',
text: 'Click Me!',
click: function(){
alert("Advanced jQuery!")
}
}).insertBefore('#disclaimer');
The problem is that is doesn't seem to work - I don't see any text and when I check the DOM or when I inspect the page using Chrome's tools for doing this I don't see any error messages in the console but neither do I see the div added to the page.
The html this refers to is:
<p id="intro">
Welcome to <strong>StarTrackr!</strong> the planet's premier celebrity tracking and monitoring service. Need to know where in the world the best bands, musicians or producers are within 2.2 square meters? You've come to the right place. We have a very special special on B-grade celebs this week, so hurry in!
</p>
<p id="disclaimer">
Disclaimer! This service is not intended for the those with criminal intent. Celebrities are kind of like people so their privacy should be respected.
</p>
Any ideas?