I have an issue where I have a for loop, that appends some data and builds a table.
for (var p = 0; p < Tbarray.length; p++)
{
if (notfirsttime == 'false')
{
$("#Ttable").append('<tr><th>Course</th><th>Places left</th><th>Time</th><th>Date</th></tr>');
$("#Ttable").append('<tr><td>' + Tbarray[p][0] + '</td><td>' + Tbarray[p][3] + '</td><td>' + Tbarray[p][2] + '</td><td>' + Tbarray[p][1] + '</td><td><button role="button" id="Signupbutton'+p+'">Sign Up</button></td></tr>');
}
notfirsttime = 'true';
} else
{
$("#Ttable").append('<tr><td>' + Tbarray[p][0] + '</td><td>' + Tbarray[p][3] + '</td><td>' + Tbarray[p][2] + '</td><td>' + Tbarray[p][1] + '</td><td><button role="button" id="Signupbutton'+p+'">Sign Up</button></td></tr>');
}
}
now this code also adds a button at the end of the row of and I could just make a hundred or so
var buttonSignup = document.getElementById("Signupbutton0");
if (buttonSignup) {
buttonSignup.addEventListener('click', test);
}
And then at least the first 100 buttons will work, but I don't know how many rows there will be. This will go up and down. I'm looking for a better way to do this. If anyone has some ideas that would be really helpful.