Hey is it possible to add a oncontextmenu to an element via JavaScript if you use appendChild???
I set my div like this:
var d = document.createElement('div');
d.id = 'G';
d.className = 'Ouput';
document.getElementById('E').appendChild(d);
But I’m wondering how i add:
oncontextmenu="return false;"
Can it be added to the Div properties before I append child or do I have to add it afterwards some how ?
You can add the oncontextmenu before or after the div is added to the dom but use a function instead of a string.
http://jsfiddle.net/mowglisanu/ZNvhD/