This question already has answers here:
jQuery in Greasemonkey 1.0 conflicts with websites using jQuery (3 answers)
How can I use jQuery in Greasemonkey? (10 answers)
Closed 3 years ago.
I'm trying to create a simple Greasemonkey script using jQuery. jQuery is already loaded from the page script.
I need a very simple change:
var $ = unsafeWindow.jQuery;
$("body").prepend('');
$("#tsDownload").click(function(){
alert("TEST!");
});
The script could add the button, but could not attach the click event, that part is simply ignored. Can you tell me why? Is something related to security? For example after a few I discovered that I had to add the first line to get jQuery from "unsafeWindow".
If I try this code from the console, it works! This is why I guess a security limit of Greasemonkey.
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)