This works fine for me:

$("<div></div>").appendTo("#main").text("appendTo").addClass("cool");

as does:

$('<div>' + 'insertAfter' + '</div>').insertAfter("#main").addClass('cool');

See here for a full page example with both:

http://paste.pocoo.org/show/83938/

- Richard

Richard D. Worth
http://rdworth.org/

On Sat, Aug 30, 2008 at 4:12 PM, Wonder95 <[EMAIL PROTECTED]> wrote:

>
>
> > $('#edit-square-area').after('<div
> class="error">'+errorMessage+'</div>');
> >
> > - Richard
>
> OK, thanks, that works in this case.  But say for some reason I need
> to add a class to the <div> dynamically.  What would the syntax be to
> shift focus to that element after appending it to #edit-square-area so
> that I could use addClass?
>
> Thanks.
>
> Steve
>

Reply via email to