Use id="whatever" rather than name="whatever". In CSS "#whatever"
refers to an element with id="whatever".

The "name" attribute is for form elements, not for general elements.

Karl Rudd

On Fri, Mar 13, 2009 at 10:02 AM, radioAM <japasc...@gmail.com> wrote:
>
> hello, i'm new at using jQuery and i'm trying to create dynamic
> content.
> the problem is thant i can't retrieve the
> new content by name.
> here is an example to reproduce what i'm saying.
>
>  (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 ?
> thanks.
>

Reply via email to