Edit in JSFiddle

$('<div class="y">xxx</div>')
    .appendTo("html");

alert($('.y').length);