Get the src of images on a website | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 1

Get the src of images on a website

I want to get the src of all the images on my webpage using JavaScript. I need help in this: I want to connect to webpage using JavaScript.Then, I want to get all the srcs of images in a page. please help me.

3rd Aug 2017, 5:30 PM
Aneesh
2 Respuestas
+ 1
you can open view source on browser and press and hold Ctrl+F to find image type
3rd Aug 2017, 5:45 PM
mohamad farbod Farrokhi
mohamad farbod Farrokhi - avatar
+ 1
let say you have a number of images in your page you can get all the src attribute and save in variable array: var source= document.getElementByName("img").src; now you can itterate through all these src attrib by for loop method
3rd Aug 2017, 7:07 PM
Peshkawt Mahmood
Peshkawt Mahmood - avatar