How to capture the src attribute of an image with a class name x?
For example:
var Image = document.getElementByClassName("Picture");
console.log(Image.src)
How to capture the src attribute of an image with a class name x?
For example:
var Image = document.getElementByClassName("Picture");
console.log(Image.src)
It can be done this way:
var image = document.getElementsByClassName('Picture');
console.log(image[0].src);
What you're wrong is calling the getElementByClassName function that is misspelled missing the 's' from 'Elements', and the fact that this function returns an array with all the elements it finds with the specified class name in the past argument, so also instead of capturing the value of the src src of the image was trying to access a src property of the array, where this property does not exist.