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

  • SEARCH
  • Home
  • 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 3500128
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:41:46+00:00 2026-05-18T12:41:46+00:00

I need to access to the data of a html cell,but before that ,I

  • 0

I need to access to the data of a html cell,but before that ,I need to store the id of my array (details[i].id) in a cell. I tried with a hidden, but I get an empty cell when I show the table and that’s not what I want, what I want is something like the DataKeyNames in ASP.net, that gives us the chance to store the id without necessarily showing it.

This is the code I use to show my array (details) in a html table:

function showTable()
{
    if (details.length>0){
        for (var i=0; i<details.length;i++)
        {
            var tbl = document.getElementById('myTable');

            var newRow = tbl.insertRow(tbl.rows.length);

            var cell1 = newRow.insertCell(0);
            cell1.textAlign='center';
            cell1.innerHTML=details[i].price;

            var cell2 = newRow.insertCell(1);
            cell2.textAlign='center';
            cell2.innerHTML=details[i].description;

            var cell3 = newRow.insertCell(2);
            cell3.textAlign='center';
            cell3.innerHTML='<a href="#"><img src="images/delete.png" width="14" height="14" alt="Delete" onclick="removeDetail(this)"/></a>'

        }



    }
}

And finally in the removeDetail function is where I need to get the cell value, assuming I somehow put the id there.

function removeDetail(r)
{
    var node = r.parentNode;
    while( node && node.tagName !== 'TR' ) {
        node = node.parentNode;
    }
    var i=node.rowIndex;

    document.getElementById('myTable').deleteRow(i);

    //here's where I need to get the id and, if posible the other values ( price, description) too.



}

Hope you can help me out.

  • 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-18T12:41:46+00:00Added an answer on May 18, 2026 at 12:41 pm

    First step: store the index as custom attribute of your element:

    cell3.innerHTML='<a href="#"><img src="images/delete.png" width="14" height="14" alt="Delete" onclick="removeDetail(this)" details_index="' + i + '" /></a>'
    

    Second step: store the row as part of the global array:

    details[i].row = newRow;
    

    Final step: In the removeDetail function read the index and you have all you need:

    function removeDetail(r)
    {
        var item = details[parseInt(r.getAttribute("details_index"), 10)];
        item.row.style.display = "none";
        alert("price: " + item.price + ", description: " + item.description);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some (small amount) of data that I'll need quick access to on
I know that's bad design, but I need access to the view from my
Problem I have various html tables that I need to parse/access from my customers
I have created application where i just need to access data form assets folder.
I am using SQLite from system.data.sqlite.org We need to access the database from many
I need to read and write some data on .mdb Access file and over
I need access to the uint64_t typedef from stdint.h in some wrapper code that
I have two different modules that need access to a single file (One will
This will probably be easy, but I need to access the values in this
I'm writing an app and I need to access some json data in the

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.