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. Advertisements

  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. Advertisements

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. gh

    DataGrid\InsertRow

    gh, Mar 10, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    504
    =?Utf-8?B?RWx0b24gVw==?=
    Mar 10, 2006
  2. shruds
    Replies:
    1
    Views:
    1,270
    John C. Bollinger
    Jan 27, 2006
  3. VictorReinhart

    GridView InsertRow

    VictorReinhart, Dec 19, 2005, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    250
    VictorReinhart
    Dec 22, 2005
  4. Marco Alting

    InsertRow() and rowIndex

    Marco Alting, Aug 19, 2003, in forum: Javascript
    Replies:
    3
    Views:
    468
    Marco Alting
    Aug 20, 2003
  5. milkyway

    javascript insertRow doesn't work ;-(

    milkyway, Dec 7, 2004, in forum: Javascript
    Replies:
    3
    Views:
    388
  6. putty
    Replies:
    1
    Views:
    383
    putty
    Apr 5, 2005
  7. Replies:
    1
    Views:
    199
  8. DL
    Replies:
    3
    Views:
    208
Loading...