'Access Images that match src

I am having 3 images. How can I access each one of them and then check the src to see if it matches a string? If the src matches a string, highlight the image.



Solution 1:[1]

if you want to a little bit more functionality than just adding css classes use:

$('img[src="matchingString"]').each(function() {
    $(this).addClass('MyCssClass');
});

Solution 2:[2]

$(":img[src='matchString']").toggleClass('yourhighlightCSScalss')

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tammo
Solution 2