Not sure this will work, but worth a try:
* greasemonkey init code + The main jquery lib code*
$('<input type="button" name="popupButton" value="popUp">').prependTo ('body').click(function() {
alert("Popup from userscript function!"); }); --Karl _________________ Karl Swedberg www.englishrules.com www.learningjquery.com On Jun 8, 2007, at 12:34 PM, emerson999 wrote:
I've been trying to use jquery within a greasemonkey script, and keep hitting the same problem. Both from a simple copy and paste of jquery into a greasemonkey script, and using the version of jquery modified for greasemonkey over at http://userscripts.org/scripts/show/7373 , there's one problem which will come up. Adding or changing something on a page works fine, except that it won't seem to add javascript functions. For example, the code below * greasemonkey init code + The main jquery lib code* function AlertBox() { alert("Popup from userscript function!") } $("body").prepend( $("<input type='button' name='popupButton' value='popUp' onclick='AlertBox()'>") ); This will create the button, but there will be no effect from clicking it, other than an error message on the console warning of a missing AlertBox function, and a view source will show no AlertBox function in the page source. Any ideas on what might be going wrong here, or if there's a way to get it working? I've tried the same code as a konqueror userscript, and everything runs perfectly.