var nextRow = tbl.tBodies[0].rows.length;
var row = tbl.tBodies[0].insertRow(nextRow);
row.setAttribute('ondblclick', "return move_to_x_graph();");
This code will add a double click event on a row. But the thing is it's not working in case of Internet Explorer.It's working fine in case of all the other browsers.
For adding style I am handling this:
var cell2 = row.insertCell(1);
var browser = navigator.appName;
if (browser == "Microsoft Internet Explorer") {
cell2.style.setAttribute("cssText", "color:black; width:300px;");
} else {
cell2.setAttribute("style", "color:black; width:300px;");
}
Can anybody help me to add double click event using Javascript that will also work in Internet Explorer?
Don't set event handlers using setAttribute, it doesn't work as you'd expect in IE. Instead set it directly on the equivalent event handler property of the element:
row.ondblclick = function() {
return move_to_x_graph();
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With