Click here to Skip to main content
15,357,293 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have 1 HTML table like Image 1 and I want to Split this Table into Multiple HTML Table Like Image2 I am Receiving Data from MySql Database and populated that data in HTML Table as per Image 1 I don't want to use jQuery I want to use only vanilla JavaScript for this thanks in advance

What I have tried:

I don't have much idea so I have yet not write any code
Updated 17-Sep-21 3:47am
snorkie 15-Sep-21 12:48pm
Try looking at it has many interesting ways to output a table and is basic javascript.

1 solution

Assuming you know how to build a table using javaScript:

1 - get data from SQL table
2 - sort data using criteria you use for separating table. You should be able to do this in you SQL query and save some effort.
3 - start build first table, test the appropriate value to see if it belongs in the next table.
4 - when it does, close current table element and start building next table. You should be able to do this all with a single table-creating loop.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900