如何使用js:http://jsfiddle.net/8p1weyud/3504/`
单击更新按钮时更新当前行/* update button */
document.querySelector('body').addEventListener('click', function(event) {
console.log(event.target)
/* //console.log(event.target.tagName.toLowerCase, event.target.className, 'dummy', event.target.className.indexOf('updateCls'))
once u click on the update button this will give the 23 of index tht shud nt show -1 here updateCls for reference */
if (event.target.tagName.toLowerCase() === 'button' && event.target.className.indexOf('updateCls') != -1) {
/*set the attribute to target the modal box ,syntx:Element.setAttribute(name, value); */
_updatebutton.setAttribute("data-target", '#formModel1')
_updatebutton.setAttribute("data-toggle", 'modal')
var row = _updatebutton.parentNode.parentNode;
document.getElementById("firstName1").value = row.cells[0].innerHTML;
document.getElementById("lastName1").value = row.cells[1].innerHTML;
document.getElementById("email1").value = row.cells[2].innerHTML;
document.getElementById("password1").value = row.cells[3].innerHTML;
document.getElementById("phoneNumber1").value = row.cells[4].innerHTML;
}
})