How to add Alt tag and Title tag to image in Blogspot automatically (without Jquery)

January 13, 2018 January 13, 2018

If you want to add Alt tag and Title tag for all images in your blogger post (even posts were published before), you can use  following code:
<b:if cond='data:view.isSingleItem'>
<script type='text/javascript'>
//<![CDATA[   
 var y = document.getElementById("Blog1").getElementsByTagName("img");for (var i = 0; i < y.length;i++) {y[i].setAttribute("alt",document.title);y[i].setAttribute("title",document.title);};
//]]>
</script>
</b:if>
Note:
1. No require Jquery library
2. Put that code before </body>
3. Old alt tag and title tag of images will be replace by new tag above.

0 comments for How to add Alt tag and Title tag to image in Blogspot automatically (without Jquery)