When I write a GreaseMonkey script, if I create a div and set onclick to warn that it works:
var btn = document.createElement('div'); btn.setAttribute('onclick',"alert('clicked!');");
However, if I ask you to do something else as previously defined, this will not work:
function graphIt() {...}; var btn = document.createElement('div'); btn.setAttribute('onclick',"graphIt();");
Is it possible to associate a function with an onclick event for a div?
greasemonkey
Kale
source share