Hi I just created a table dynamically, its working fine, but I need a on click on imageId. So what I did is:
document.getElementById("imageId").addEventListener("click", function () {
alert("hello");
});
but it is not working, I don't need any jquery only using JavaScript.
The code creating table dynamically is given below and it is working fine.
var body = document.body,
tbl = document.createElement('table'),
tableId = document.createAttribute('id');
tbl.style.width = '100%';
for (var i = 0; i < 3; i++) {
var tr = tbl.insertRow();
tr.style.height= '40px';
var timetd = tr.insertCell();
var tdcompany = tr.insertCell();
var chatsymbol = tr.insertCell();
var amounttd = tr.insertCell();
tdcompany.innerHTML = "abc";
timetd.innerHTML = "ss";
chatsymbol.innerHTML = '<img src=\'images/iproseIcon2.png\' width= "35%" margin-top="10px"; >';
amounttd.innerHTML = total + '<img id="imageId" src=\'images/iconarrowright.png\' >';
}