[jQuery] $(byName) <> $(byClass) on dynamic content

[jQuery] $(byName) <> $(byClass) on dynamic content


hello, i'm creating dynamic content in a page, but when i use
the $ function to retrieve the new content, i'm can't find elements by
name
here is an example to reproduce the behavior
(function() {
fn = function() {
$('.widgetBar').append('<div class=\'acc1\'></div>');
var acc = $('.acc1');
//var htmlText = '<a class=\'widgetBasSelector basic\'>Hola!!</
a><div class=pp name=\'div1\'></div>';
var htmlText = '<a class=\'widgetBasSelector basic\'>Hola!!</
a><div class=pp name=div1></div>';
acc.append(htmlText);
alert($('#div1').size()); // Returns 0
alert($('.pp').size()); // Returns 1
};
$(fn);
return;
})
();
what i'm doing wrong ?
i'm using jquery 1.3.2,
$('.widgetBar') returns one div element.
thanks.