+ 1

Create a table using JS

I'm trying to create a table with JavaScript, where every table cell has a unique id. How would I do this, I've tried but failed.... Please help me

6th Jul 2018, 1:05 PM
Paul Grasser
Paul Grasser - avatar
6 odpowiedzi
+ 4
Your issue was trying to modify the DOM prior to it loading. https://code.sololearn.com/Wji67RUSYw66
6th Jul 2018, 4:15 PM
John Wells
John Wells - avatar
+ 7
The best method to get help is link your code. That allows us to see what you are doing and fix it. Instead of guessing and providing something that is useless to you.
6th Jul 2018, 2:00 PM
John Wells
John Wells - avatar
+ 6
I'm filling out a table in this code. https://code.sololearn.com/W0SpGiJ3Vfzb The empty table is in the HTML. The rows and columns are added in the JavaScript.
6th Jul 2018, 2:15 PM
John Wells
John Wells - avatar
+ 5
row 1 column 1 id matches row 11 id. Stick a letter in to make them unique. Updated mine to r11 for row c11 for cell.
6th Jul 2018, 4:59 PM
John Wells
John Wells - avatar
0
John Wells Here you go: https://code.sololearn.com/W1kw1OVKWeqJ/?ref=app So what I want to do is: Create an empty table Use a for loop and jQuery to add rows and cells, each row/cell has the id of the for loop's integer (so i/j in my case) But nothing happens...
6th Jul 2018, 4:08 PM
Paul Grasser
Paul Grasser - avatar
0
John Wells But now when I try to make it, say, a 20x20 Table by increasing the max size.of i/j, it looks weird, see my newest "share anything coding" post to see what I mean...
6th Jul 2018, 4:46 PM
Paul Grasser
Paul Grasser - avatar