I want to add a tool-tip for each of the table rows that are being created in a HTML
table:
document.getElementById("insert").addEventListener("click",function(){
table.insertRow(table.rows.length);
//add a tooltip for each row
})
How do I go about it?
CodePudding user response:
you can use setAttribute methods.
document.getElementById("insert").addEventListener("click",function(){
//add a tooltip for each row
var newRow = table.insertRow(table.rows.length);
newRow.setAttribute("title", "tooltip text");
})