Skip to content

Instantly share code, notes, and snippets.

@DylanCh
Created August 18, 2017 13:59
Show Gist options
  • Save DylanCh/8a78b1efd78a04275ce0bd1cba8e691c to your computer and use it in GitHub Desktop.
Save DylanCh/8a78b1efd78a04275ce0bd1cba8e691c to your computer and use it in GitHub Desktop.
'use strict';
var rowHandler = ()=>{
var table = document.getElementById("table1");
var rows = table.getElementsByTagName("tr");
for (i = 0; i < rows.length; i++) {
var curRow = table.rows[i];
var onclikHandler = (row)=>{
return ()=>{
var cell = row.getElementsByTagName("td")[3];
var color = cell.innerHTML;
document.getElementById('alert').innerHTML = color;
$(#alert).alert();
};
};
curRow.onClick = onclickHandler(curRow);
}
};
window.onload = rowHandler();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment