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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:21:49+00:00 2026-06-15T15:21:49+00:00

http://fiddle.jshell.net/kBFU7/2/ In the code, I have created a dynamic table through jQuery. I also

  • 0

http://fiddle.jshell.net/kBFU7/2/
In the code, I have created a dynamic table through jQuery.
I also have a div for each table cell.
I wish to store and access data of this div, eg, the row and column for each of it.

I would hence like to ask for some recommendations on how I should go about storing this data.
I have tried creating a span for each div to store info in it following the suggestions from this link http://time2hack.blogspot.sg/2012/11/jquery-store-access-relative-info-within-HTML-element.html#axzz2Ee3iLxCt but it did not seem appropriate and I have failed at accessing back the info.

I would appreciate it if someone could just give me some recommendations which I could try 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-06-15T15:21:50+00:00Added an answer on June 15, 2026 at 3:21 pm

    So basically you want to create a dynamic table and access each of the TDs and its data.
    In order to do that, you don’t need any div or span to place inside those TDs to access their content (if that is all that you want). The simplest way to do so is to assign an id to each of these TDs according to their Row and Column position. That way you can access each of them in a loop or directly or what not.

    below I’ve written a super simple way to achieve it. Of course you can customize or enhance it according to your need. but then you should get the idea right?

    (I am using ur code to do that)

    $(document).ready(function() {
    createTable($("#tb1"));
        function createTable(tbody){
          if (tbody == null || tbody.length < 1) return;
          for(var r=0;r<5;r++){
            var trow=$("<tr>");
            for(var c=0; c<5;c++){
                var tcol=$("<td>")
                tcol.attr("id","row"+r+"col"+c); /// assign id to each td
    
                var cellText = "row " +r + " col " +c 
                $("<div>")
                    .text(cellText)
                    .appendTo(tcol)
    
                tcol
                    .appendTo(trow)
            }
            trow.appendTo(tbody);
          }
        }    
    });
    

    so basically you did this:

    <td id="row1col1"></td>
       <td id="row1col2" ></td>
    

    now whenever you want to access any of the cells do this

    $('#row1col1').text();
    or
    $('#row1col1').html();
    

    ​
    you can access the cells in a loop like

    for(var r=0;r<5;r++){
        for(var c=0;c<5;c++){
    
           var cellValue=   $('#row'+r+"col"+c).text() // or .html()
    
             makeAjaxRequest(cellValue); /// send to server or whatever
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following menu: http://fiddle.jshell.net/KQYsn/1/ Click on link User and you will see
I have a form: http://fiddle.jshell.net/eJ2kS/ I want to have the label and text input
I have made a fiddle: http://jsfiddle.net/csS24/ I'm trying to get the code to a
Consider this jsfiddle: http://fiddle.jshell.net/maple/JbEJN/show/ (this is the result window, in order for replaceState to
I have this fiddle: http://jsfiddle.net/9J5Fg/ When one box is open and I click on
See this fiddle: http://jsfiddle.net/uqJHf/ I have set the first column to show up with
Here is the fiddle: http://jsfiddle.net/7txt3/29/ I want to have the record needle on the
In this fiddle - http://jsfiddle.net/zyUkd/26/ I am attempting to enable the div Hello 01
See this fiddle: http://jsfiddle.net/Bg9Zx/5/ Relevant code: <fieldset data-role=controlgroup data-type=horizontal id=locate-me> <input type=checkbox name=loc id=loc
I have this Fiddle: http://jsfiddle.net/GSA5R/2/ Whereby i use the border property to create 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.