Skip to content

Commit

Permalink
Create Alt text instead of <img>
Browse files Browse the repository at this point in the history
  • Loading branch information
do-your-own-seo committed Sep 5, 2022
1 parent 9bca348 commit ecf8549
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Alt text instead of <img>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
javascript: (function() {
function toArray(c) {
let k, a = new Array;
for (k = 0; k < c.length; ++k) a[k] = c[k];
return a;
}
let img, altText, images = toArray(document.images);
for (let i = 0; i < images.length; ++i) {
img = images[i];
altText = document.createTextNode(img.alt);
img.parentNode.replaceChild(altText, img)
}
})();

0 comments on commit ecf8549

Please sign in to comment.