insertRow and id tag

Discussion in 'Javascript' started by Christopher Berg, Nov 9, 2006.

  1. 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.
     
    Christopher Berg, Nov 9, 2006
    #1
    1. Advertising

  2. Christopher Berg

    RobG Guest

    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-HTML/html.html#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
     
    RobG, Nov 10, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. shruds
    Replies:
    1
    Views:
    835
    John C. Bollinger
    Jan 27, 2006
  2. Marco Alting

    InsertRow() and rowIndex

    Marco Alting, Aug 19, 2003, in forum: Javascript
    Replies:
    3
    Views:
    268
    Marco Alting
    Aug 20, 2003
  3. putty
    Replies:
    1
    Views:
    260
    putty
    Apr 5, 2005
  4. Replies:
    1
    Views:
    105
  5. DL
    Replies:
    3
    Views:
    128
Loading...

Share This Page