Need help to make popup image

Hello, I needed to help make images to pop up when it is clicked…I got a code from w3 School… but when I am pasting the codes in my WordPress site’s post, it is not working, the image is not popping up…:pensive: please help me with that code…

The w3 code link:

It works there…but in my post it doesn’t…any solution?? To make working in my WordPress site…:pray::pensive:

Do you get any errors in your console?