On Apr 19, 2009, at 10:25 PM, kstubs wrote:
> I would like to insert a table-row adjacent to a given table-row. I
> have tr elements like this:
>
> <tr id='2349'>...</tr>
> <tr id='2456'>...</tr>
> <tr id='2873'>...</tr>
> <tr id='2294'>...</tr>
>
> so can easily get a reference to my tr element like this:
>
> var tr = $('2456');
An ID must begin with at least one alphabetical character or an
underscore, it may not begin with a number.
>
>
> So how do I achieve an insertion just after this element like this:
>
> <tr id='2349'>...</tr>
> <tr id='2456'>...</tr>
>
> ... insert a new tr element here ...
>
> <tr id='2873'>...</tr>
> <tr id='2294'>...</tr>
>
>
> Do I have to redraw the entire table?
No. Assuming you had made your IDs "legal", you could do this:
$('row_2456').insert({after:'<tr id="row_whatever"> ... </tr>'});
Walter
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---