[jQuery] Re: [ Add Onclick on loaded image ]
Thanks Kevin ! Regards, amdys On Fri, Jul 11, 2008 at 5:54 AM, Kevin Pepperman [EMAIL PROTECTED] wrote: since the image is loaded dynamicly,you should use the jquery.listen plugin. It will allow you to 'listen' for the element and attach a click event to the newly created image. $('#mydiv').listen( 'click', 'img.myimgclass', function(){ //My code to run });
[jQuery] Re: [ Add Onclick on loaded image ]
Hi Kevin do you have any clue how can i add some progress image on top of the real image while there downloading ? Thanks, Regards Amdys On Fri, Jul 11, 2008 at 4:32 PM, Topayung, Amdys Max [EMAIL PROTECTED] wrote: Thanks Kevin ! Regards, amdys On Fri, Jul 11, 2008 at 5:54 AM, Kevin Pepperman [EMAIL PROTECTED] wrote: since the image is loaded dynamicly,you should use the jquery.listen plugin. It will allow you to 'listen' for the element and attach a click event to the newly created image. $('#mydiv').listen( 'click', 'img.myimgclass', function(){ //My code to run });
[jQuery] Re: [ Add Onclick on loaded image ]
Hi,, This is what i change so far.. But it always execute the alert each time the image is loading. $.fn.image = function(src, f){ return this.each(function(){ var i = new Image(); i.src = src; i.onload = f; *i.onclick = alert(c);* this.appendChild(i); }); } $(#thumbnail).image(returData[0],*satu*,function(){}); Thanks.. Regards. Amdys
[jQuery] Re: [ Add Onclick on loaded image ]
since the image is loaded dynamicly,you should use the jquery.listen plugin. It will allow you to 'listen' for the element and attach a click event to the newly created image. $('#mydiv').listen( 'click', 'img.myimgclass', function(){ //My code to run }); On Thu, Jul 10, 2008 at 7:30 AM, Topayung, Amdys Max [EMAIL PROTECTED] wrote: Hi,, This is what i change so far.. But it always execute the alert each time the image is loading. $.fn.image = function(src, f){ return this.each(function(){ var i = new Image(); i.src = src; i.onload = f; *i.onclick = alert(c);* this.appendChild(i); }); } $(#thumbnail).image(returData[0],*satu*,function(){}); Thanks.. Regards. Amdys -- Robert Benchley - Drawing on my fine command of the English language, I said nothing.