Javascript Escape Character
I am dynamically adding rows to a table. For one of the cells(cell8), I
want to be able to click to call a javascript function
(saveDeleteAction(rowIndex)) with the rowIndex as the parameter value. The
HTML generated does not produce the actual value of rowIndex:
function addRowToTable(entity,rowIndex)
{
var table=document.getElementById("entity");
var row=table.insertRow(-1);
var cell8=row.insertCell(7);
cell8.innerHTML= saveDeleteAction(rowIndex);
}
function saveDeleteAction(rowIndex) {
return '<a href=\'javascript:testing(rowIndex)\'; class="btn btn-small
btn-warning"><i class="btn-icon-only icon-ok"></i></a> <a
href="javascript:;" class="btn btn-small"><i class="btn-icon-only
icon-remove"></i></a>';
}
function testing(rowIndex){
alert(rowIndex);
}
HTML GENERATED
<a href="javascript:testing(rowIndex)" ;="" class="btn btn-small
btn-warning"><i class="btn-icon-only icon-ok"></i></a>
No comments:
Post a Comment