Friday, October 2, 2009

[jQuery] Re: How to manipulate an object containaing HTML

On 1 oct, 20:07, Karl Swedberg <k...@englishrules.com> wrote:
> Sure, you can do this with html.
>
> Inside the success callback function, do this:
>
> $(html)
>    .find("td")
>      .css('padding-left','80px')
>    .end()
>     .appendTo('#myTable');

great! that's the .end() part i was missing!
Thanks, i can now sleep nicely :)

> I agree with Charlie that it's a better idea to set the style with css  
> and then just add a class to the td elements. Whether you do that  
> server-side or in the success callback is up to you.

This example was just for illustration purpose. What i need to do is
more complicated than that and actually done by server-side scripting.
I just wanted to understand exactly how jquery worked. Since when not
specifiying the context (thus working with the current document DOM)
it worked implicitly i was sure there was a way to get this done
within a specified context.

> Also, you ought to append table rows to a <tbody>, not to a <table>.

That's for sure, illustration purpose again :)
Thanks to both of you for that help!

No comments: