Skip to content

Instantly share code, notes, and snippets.

@BelfordZ
Created May 22, 2017 03:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BelfordZ/fc65bb496ce247276f9e9afbaeab4497 to your computer and use it in GitHub Desktop.
Save BelfordZ/fc65bb496ce247276f9e9afbaeab4497 to your computer and use it in GitHub Desktop.
get all the images from a webpage as an array
var a = document.getElementsByTagName('img'); var b = []; for (var i = 0; i < a.length; i++) { if (a[i].src.indexOf('http') !== -1) { b.push(a[i].src); } } console.log(`["${b.join(',')}"]`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment