Why this
$(\"#mydiv\").append(\"\"); $(\"#mydiv\").append(\"Hello\"); $(\"#mydiv\").append(\"\"); alert($(\"#mydiv\").
Because you can't append the unfinished pieces of HTML, you always append the element. For your case you have do either
$("#mydiv").append(""); $("#mydiv ul").append("Hello");
or
$("#mydiv").append("Hello");