Internet Explorer "setAttribute" onclick workaround?

var tr = document.createElement('tr');
tr.setAttribute("onclick",p.onrowclick+"("+row.id+")");

Hi, everything above works fine for me in Firefox. I cannot find the correct syntax for the workaround in IE.

I am using IE8.

+5
source share
2 answers

Do not set such events. Pass it the correct function:

tr.onclick = function() { p.onrowclick(...); }  
+3
source

Works only with IE, but is not offered:

var tr = document.createElement('<tr onclick="p.onrowclick('+row.id+')">');
0
source

All Articles