Replace me
Javascript
picsum image

This uses the showModal() method

picsum image

A random image from Picsum Photos

Buttons JS

Each button has two click events. One is from it's individual ID. The other, changing the button colour, is done by using querySelectorAll('.btn') on every button with a class of btn.


const btns = document.querySelectorAll('.btn');

btns.forEach((btn) => {
    btn.addEventListener('click', (e) => {
    btns.forEach((btn) => {
        btn.classList.remove('clicked');
    });

    e.target.classList.add('clicked');
    });
});
            
            

Module cheatsheet