"onclick" doesn't work

Hello

Why doesn’t “onclick” work? http://jsfiddle.net/8Observer8/S7zRe/

Thank you in advance!

What error message do you see in the console?

This message: Uncaught TypeError: Object #<HTMLBodyElement> has no method ‘appendText’

P.S. This example from the book: http://www.amazon.com/Professional-jQuery-Cesar-Otero/dp/1118026683

Exactly, there is no method appendText.

Saying that, you could make one:

function appendText(node, txt) {
    node.appendChild(document.createTextNode(txt));
}

document.getElementById("clickDiv").onclick = function () {
    appendText(document.body, "clicked");
};

Thank you very much :slight_smile: