I am at an academy where they are asking me to put in a 800px image and then use the <img>: class = "small" tag to make it shrink and then they tell me this:
The goal of this part of the project is that you will use JavaScript to either remove this "small" class (and thus the image will grow) or reposition it (thus it will become small again) when the user clicks.
You need to use the classList property of the HTML element.
// Select the element
const myElement = document.querySelector("#my-element");
// Add a class
myElement.classList.add("class-to-add");
// Remove a class
myElement.classList.remove("class-to-remove");
Here is the corresponding documentation: https://developer.mozilla.org/docs/Web/API/Element/classList
// garp the image by it's className
const myImage = document.querySelector('.myImage')
// add event listener to respond click event
myImage.addEventListener('click', () => {
// it will toggle on and off whene ever used clicks it
myImage.classList.toggle('small')
})