I have this code in Ajax/Javascript where I am generating a dynamic table that should hold some returned value. At the beggining of each row I would like to have a column of radio buttons, that I could use to identify a particular row. How can I create radio buttons inside the table? Thanks
Here is my code:
for (var i = 0; i < controller_data.length; i++) {
tr = $('<tr/>');
// this is the row where the radio button should be
tr.append("<td> <input type="radio"> </td>");
tr.append("<td>" + controller_data[i].id + "</td>");
tr.append("<td>" + controller_data[i].question + "</td>");
tr.append("<td>" + controller_data[i].image + "</td>");
tr.append("<td>" + controller_data[i].answer1 + "</td>");
tr.append("<td>" + controller_data[i].answer2 + "</td>");
tr.append("<td>" + controller_data[i].answer3 + "</td>");
tr.append("<td>" + controller_data[i].answer4 + "</td>");
$('table').append(tr);
}