Hi Nicky,

where do the variables elm, and serial come from?

Your posted code snipped looks ok, and it's working fine if you
populate the elm and serial with meaningful values. (see example:
http://jsbin.com/oxehe/edit)

I guess there is a problem with elm. Are you sure it holds exactly 1
DOM element?
Is serial a unique ID?

by(e)
Stephan


2009/1/31 Nicky <nha...@gmail.com>:
>
> Ah, very sorry about that mistype, but that is in fact what I am doing
> (just replaced my code wrong when I changed what I have to 'someID')
>
> Here's what I have, exactly:
>
>        $('<div/>')
>                .attr('id', 'ntww-'+serial)
>                .insertBefore(elm);
>        $('<p/>')
>                .appendTo('#ntww-'+serial);
>
> Sorry about that and thanks for the reply!
>
> -Nicky
>
> On Jan 31, 9:28 am, Stephan Veigl <stephan.ve...@gmail.com> wrote:
>> the selector for an id is #, sou you should use "#someID" instead of
>> "someID" for the appendTo() function.
>>
>> by(e)
>> Stephan
>>
>> 2009/1/31 Nicky <nha...@gmail.com>:
>>
>>
>>
>> > Hi All,
>>
>> > I'm fairly new to jQuery so I apologize if I'm missing something
>> > straightforward but doing this:
>>
>> > $('<div/>')
>> >        .attr('id', 'someID')
>> >        .insertBefore(elm);
>> > $('<p/>')
>> >        .appendTo('someID');
>>
>> > Seems to give me errors. If I change "appendTo('someID')" to a
>> > different element's ID, it works fine, so I get the feeling that it
>> > can't append to the just-created div. Is this not the case? What
>> > should I do to move forward?
>>
>> > Thanks for the help!

Reply via email to