Image upload event after image upload

I have a script that attaches onload event handlers to all the images on the page, however, since this is a GreaseMonkey script, it can only work after the images are there, so some of them may already be loaded, there is a way to trigger the onload event. if the image is already uploaded?

+6
source share
3 answers

If you don't deny using a framework like jQuery, there is a triggerHandler () function that should do what you need.

You will need a test to check if the image is uploaded to your script (it should find information on how to do this using Google) - if it has not been uploaded, just attach the onload event handler; if it was loaded, you can either attach an onload event handler, or then run it using the jQuery triggerHandler () function, or execute a code / function that would be executed by the onload event handler, which most of all depends on the handler onload events.

+1
source

This is an onload event. I would not have thought that an event would fire more than once.

You can attach your script to the onload body / document event and view all the images and attach your event handlers, possibly.

0
source

, Google .

jQuery, . , "src" (, 1pix.png) "src", . , , / ... , , ( , , ...).

, !

PS: , @Bugster, !

-1

All Articles