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 9178637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:35:59+00:00 2026-06-17T17:35:59+00:00

I know almost any item in the DOM can have an id attribute, and

  • 0

I know almost any item in the DOM can have an “id” attribute, and I’ve been using it to keep track of each client in a table of clients. I also am aware, that you are not supposed to have any id be repeated. In my code, the id of the row is set to each person’s “clientId”, which comes from a unique key in a database, so there will be no repeats… but elsewhere on the page is an “issues” table, where i have been setting the id of each row to the “issueId” (again a unique key), but I realized that a clientId, could potentially match an issueId, and I don’t know the consequence.

I’m looking for a way to identify the each row so I can call them up later. Is there another attribute I can use that would be preferred for this? should I just add the word “client” in front of the number when assigning the id’s? I want to use standard practices and have a fast web app here.

It’s ok if a client and a issue number match because I will always know which one I’m looking for and I can drill down to the table first when looking for it. I just don’t want to use “id” because its illegal to have id’s repeat. For example if I’m looking for an issue I can use something like. document.getElementById("issueTable").getElementBySOMETHING(issueId) instead of just document.getElementBySOMETHING(issueId)

  • 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-06-17T17:36:00+00:00Added an answer on June 17, 2026 at 5:36 pm

    To make sure that there are no conflicts, you could add a unique prefix to your id values, for example, client-X or issue-X.
    Now, even if they share the same key, the id attribute is different for each due to this prefix. You could then modify your lookup code as follows

    document.getElementById('issue-'+key); // get by issue
    document.getElementById('client-'+key); // get by client
    

    This means you can get your element in one lookup and using getElementById which is one of the fastest methods. Furthermore, this method means you won’t have previous generation browsers have trouble with a key beginning with a number should you want to use a CSS rule to style the element differently.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know there have been many questions on grid and pack in the past
I know I can get the value attribute of a radiobutton but I'm finding
Do you know of any resources or libraries of BDD specs? For example, almost
The string formatting concept found in sprintf can be found in almost any language
I know almost nothing about cryptography, but I would like to figure out how
I had some experience of android but know almost nothing of GCC Makefile. Here
Ok so I start coding websites (yes I know I am almost 15 years
I'm making an app and I'm almost done. I just need to know how
Know this might be rather basic, but I been trying to figure out how
Know if it's possible to access the iPhone compass in Safari using JavaScript? I

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.