Nikolai
Nikolai

Reputation: 3134

Removing event handler from Greasemonkey

There's a page that has a hover event defined inside the page script as such:

$(".post.fade").hover(function () {
    $(this).addClass("over");
},function () {
    $(this).removeClass("over");
});

I want to remove that handler because it's annoying. However, although $(".post.fade").unbind(); works from inside the Firebug console, it doesn't from Greasemonekey. I'm sure jQuery is loaded properly because $(".post.fade").remove(): does work.

I suppose Greasemonkey doesn't have access to the page's event handlers or something. I tried unsafeWindow but it still doesn't work.

Is there any way?

EDIT:

Apparently, the solution was to put the code inside $(document).ready(). Not sure why, though. And yes, the unsafeWindow is still required.

Upvotes: 0

Views: 1625

Answers (1)

Nikolai
Nikolai

Reputation: 3134

Apparently, the solution was to put the code inside $(document).ready(). Not sure why, though. And yes, the unsafeWindow is still required.

Upvotes: 1

Related Questions