Last active
October 6, 2021 09:08
-
-
Save riccardomares/4dd5aeaac9af3af6f8f61ecc0348c668 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Find IMG tags without width or height definitions | |
@note: please use https://mrcoles.com/bookmarklet/ to create your own bookmarklet | |
*/ | |
function getImageWithoutDimensions(){ | |
console.group("getImageWithoutDimensions"); | |
n = 0; | |
imArray = []; | |
is = document.getElementsByTagName("img"); | |
for (i=0;i<is.length;i++){ | |
if (is[i].getAttribute("width") == null || is[i].getAttribute("height") == null){ | |
console.log(is[i]); | |
imArray.push(is[i]); | |
n++; | |
} | |
} | |
console.groupEnd(); | |
alert("You have " + n + " img tag without width or height"); | |
return imArray; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment