Replacing IMG alt values with title in js
Printing Digital
Posted on September 10, 2020
We recently wanted to clean up some existing Wordpress sites for SEO, and part of that process involved fixing missing or broken IMG tags.
Here's a quick fix jquery solution for Wordpress you can use to replace IMG titles with the alt tag automatically. This way all your images without alt tags will be populated.
jQuery(document).ready(function(){
jQuery("img").attr("title", function() {
var theValue = jQuery(this).attr("alt");
return theValue;
});
});
In action at
Printing New York
Luxury Printing
Gorilla Printing
Printing Brooklyn
đź’– đź’Ş đź™… đźš©
Printing Digital
Posted on September 10, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.