You could try .append()
, which would not necessarily expect a jQuery object and you could pass an html String.
$(function() {
if($(document).height() > $(window).height()) {
$("#footer").append("| <a class=\"footer top\" href=\"\">Top of Page ↑</a>");
}
});
Working fiddle: http://jsfiddle.net/DG3w6/