JQuery - select image by alt or title

Hello, I need this jQuery to run for the image below. But here is the trick I need to choose for it, alt, I can't get jQuery to select it

<script>                                    
 $('img[alt="800px-Red_Bull"]').onload = function() {
 Pixastic.process(img, "desaturate", {average : false});
</script>

<img width="800" height="387" src=".../01/800px-Red_Bull.png" alt="800px-Red_Bull" title="800px-Red_Bull">
+5
source share
2 answers

Your problem is not related to your selector, it means that you are not using the event loadcorrectly.

Change the code as follows:

$('img[alt="800px-Red_Bull"]').load(function() {
    Pixastic.process(img, "desaturate", {average : false});
});
+13
source

Try:


$('img[alt="800px-Red_Bull"]').load(function () {
 Pixastic.process(img, "desaturate", {average : false});
});

+2
source

All Articles