Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1042215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:28:23+00:00 2026-05-16T15:28:23+00:00

For chrome, firefox, and safari the following code seems to work and be able

  • 0

For chrome, firefox, and safari the following code seems to work and be able to retrieve the id of the last tr in a table.

var table = document.getElementById( tableId );
    var rowid = table.lastChild.lastChild.id;

The goal is to use each rows id to keep track of what row number it is. I am using javascript to dynamcially add and remove rows. The problem is that I need a unique identifier for each row so that rows can be removed. If say there are 4 rows and row 2 is removed, the count will be 1, 3, 4. If another row is added, it can’t be 4 or there will be duplicate 4’s. The correct way would be to renumber everything, (but there are many elements in each row tied to their count, thus making it near hard to re-number)

Is there a better way to be doing this? Or is there a simple fix for IE javascript?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T15:28:24+00:00Added an answer on May 16, 2026 at 3:28 pm

    try this:

    var table = document.getElementById( tableId );
    var trArr = table.getElementsByTagName('tr');
    var tdArr = trArr[trArr.length - 1].getElementsByTagName('td');
    var rowid = tdArr[tdArr.length - 1].id;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: for (i=1; i<=len; i++) { var optcheck = col+'|'+document.getElementById('color').options[i].value;
IE7 and IE8 are not letting me splice my array (Safari, Chrome, Firefox work):
In Chrome and Safari a remote image included on my site never seems to
I get the following error in Firefox 4 only (not in FF 3.6.16, Safari,
I've developed an extension for firefox and google chrome , safari and ie8+ .
I have a problem with the following code, which doesn't want to work in
works on safari/firefox/chrome/opera for mac + pc. But not for safari iPhone. error occurred
I'm having a hard time figuring out how Firefox and Chrome determining what fields
Here's the page: https://www.testmasters.net/test/ssltest2.aspx When I go to it (in firefox or chrome), it
I understand that Firefox addins can be created in Javascript and Chrome. How do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.