From: Tane Piper <digitalspaghe...@googlemail.com>
Date: Sun, 11 May 2008 05:20:43 -0700 (PDT)
Local: Sun 11 May 2008 13:20
Subject: Problem binding to Dynamic elements in Greasemonkey
Hey there,
I'm writing a script in Greasemonkey that uses jQuery + Livequery +
So far I've managed to get it as far as creating the link on the page,
Here is what I have cut down (as there is a lot of included library
ScrobbleClick = jQuery.klass({
});
ScrobbleSong = jQuery.klass({
initialize : function(options) { var el = jQuery(this.element); /* Some code in here where I create the url */
el.append('<a href="'+url+'" class="scrobble">Scrobble This</a>');
});
setTimeout(function(){
jQuery('.song').each(function(){ jQuery(this).attach(ScrobbleSong); }); }, 3000);
What the script does is wait until a auth request has been made (not
shown here) which is successful, I attach the link to the div. Then I bind the ScrobbleClick. As I've said, the initialize works, so it must know the element is there, however it ignores the onclick function. Anyone any ideas???? You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||