This uses the showModal() method
showModal()
A random image from Picsum Photos
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.
querySelectorAll('.btn')
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'); }); });