I have some images, all of which have alt tags.
I am trying to add a class to all of the images which have a certain alt tag.
So to put it in plain terms:
If image alt
tag = "dog" then add class "canine"
Any ideas?
thanks
You can use the attribute equals selector and addClass method:
$("img[alt='dog']").addClass("canine");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With