Hi Fred, I'll answer your second question:
On Oct 15, 2009, at 9:03 PM, Frederic Laruelle wrote:
On a related note, how does JQuery allow you to nest append
statements?
Since chaining returns the parent element (matched by $), the
following statement obviously doesn't work as intended:
$("#result").append("<table/>").append("<tr/>").append("<td>")
Can this be rewritten to work?
(i have tried parenthesis grouping, however that was unsuccessful)
It might be easier to do it like this:
$('#result').append('<table><tr><td></td></tr></table>');
But if you really wanted to keep the append chain, you'd have to add a
traversal method in between:
$('#result').append('<table/>').find('table').append('<tr/
>').find('tr').append('<td/>')
( you could use .children() instead of .find() )
That seems like quite a bit of work, though.
--Karl
____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com