I am trying to create div elements dynamically, and at the time of creation i am using onClick = 'showDimension();'. It shows the correct html on alert box but when DIV is created you can see that div is not having any onClick method attached [ firebug ]. Instead of that it is having a stray string 'showDimension();'. Why it is happening ? How to resolve it?
http://jsbin.com/inoqi3/3
Also, you can see that i am using
var eventDe = " onClick='showDimension("+i +");'";
and then, later this i will be used to find out the div id. Quite obvious it is not correct approach. How to use the event.target or event.srcElement to get the div from which the event is fired? I tried but unable to use that.