How can I make a table of 52 rows and column in html without writing codes for each of them. | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grátis
+ 1

How can I make a table of 52 rows and column in html without writing codes for each of them.

13th Jun 2020, 2:59 PM
Jerry Adeboye
5 Respostas
+ 2
HTML: ———————————————— <div id="test"></div> ———————————————— JS (tarr with your 52 elements): ———————————————— let row, test = document.querySelector('#test'), tarr = ["ja1","ja2","ja3","ja4"]; for(let k=0;k<52;k++){ row = creTr(4,"th",tarr); test.appendChild(row); } function creTr(nc,typ,item){ let type, txt; let tr = document.createElement("tr"); for(let i=0;i<nc;i++){ type = document.createElement(typ); txt = document.createTextNode(item[i]); type.appendChild(txt); tr.appendChild(type); } return tr; }
13th Jun 2020, 4:13 PM
JaScript
JaScript - avatar
+ 1
Type <tr> inside the <table> for 52 times and type <th> for 52 time inside each <th>.
13th Jun 2020, 3:05 PM
Omkar Kamat
Omkar Kamat - avatar
+ 1
You can copy paste the first row of 52 columns to make you work simple
13th Jun 2020, 3:12 PM
Omkar Kamat
Omkar Kamat - avatar
+ 1
https://code.sololearn.com/WUHR9I6JXs77/?ref=app check this code. I have implemented something similar there.
13th Jun 2020, 4:04 PM
Washiul Alam Sohan
Washiul Alam Sohan - avatar
0
That's what I running away from. I just want a code that will bring it out once
13th Jun 2020, 3:11 PM
Jerry Adeboye