You convert a string to a jquery object with $(message). basically you are messageno longer making a string, but a jquery selector. Try the following:
function debug(message){
$('body').append($('<div>').attr('id','debug').text(message));
}
note. I use .attr and .text, as this extra bid is more secure when adding information.
. : ID - HTML. , , perm. "div", .text(), debug [CSS] div.