I am generating a table and when I create the rows I have a for loop like this:
for (var i = 0 ; i < myList.length ; i++) {
var row$ = $('<tr/>');
for (var colIndex = 0 ; colIndex < columns.length ; colIndex++) {
if (columns[colIndex] == 'web_id'){
cellValue = "<a onclick='showMoreData('myList[i][columns[colIndex]]')'>" + myList[i][columns[colIndex]] + "</a>"
}
else {
var cellValue = myList[i][columns[colIndex]];
}
if (cellValue == null) { cellValue = ""; }
row$.append($('<td/>').html(cellValue));
}
$(".table").append(row$);
but this isn't working, what do I need to do to add an onclick event based on the row's content in a column so that I can add a dynamic link?
cellValue = "<a onclick=\"showMoreData('myList[i][columns[colIndex]]')\">" + myList[i][columns[colIndex]] + "</a>"