469,338 Members | 7,976 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,338 developers. It's quick & easy.

insertRow and id tag

hi.
is there a way to add an id='...' tag to a table row when using
the javascript insertRow() ?

i wish to be able to manipulate this row later if i need to
using that identifier (eg to toggle its display style).

thank you.

Nov 9 '06 #1
1 2745

Christopher Berg wrote:
hi.
is there a way to add an id='...' tag to a table row when using
the javascript insertRow() ?
You mean add an id attribute? Yes, insertRow returns a reference to the
newly created row:

<URL: http://www.w3.org/TR/DOM-Level-2-HTM...ml#ID-39872903 >

var newRow = tableSection.insertRow(-1);
newRow.id = 'someUniqueID';

i wish to be able to manipulate this row later if i need to
using that identifier (eg to toggle its display style).
That seems to indicate that you will use getElementById. Consider
other methods, say keeping references to rows in an object or array, or
use an intrinsic event - they may be more robust and faster.
--
Rob

Nov 9 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Marco Alting | last post: by
3 posts views Thread by milkyway | last post: by
2 posts views Thread by Howard Jess | last post: by
1 post views Thread by Tony | last post: by
8 posts views Thread by Hal Burgiss | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Purva khokhar | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.