I have a table that is created dynamically, I want the contents of the table in an array to mean in a variable (like var k = {1.hai 2.me 3.you ....}). I use this code, but it is not very good.
var x = $("tr[id='1'] > td:nth-child(1)").html()
x1 = $("tr[id='2'] > td:nth-child(1)").html();
x2 = $("tr[id='3'] > td:nth-child(1)").html();
x3 = $("tr[id='4'] > td:nth-child(1)").html();....
......
var y=[x,x1,x2,x3,.....................]
Run codeHide resultHow to do this using a loop?
source
share