Simple custom javascript de-bugging

I’m new to coding and Webflow, so this query is probably an easy one to solve. I’m trying to add custom Javascript to my project. I have a Div called slides, with a tag and an ID. I’m testing to see if my Javascript is even working:

Does anyone know what I’m forgetting or doing wrong?

Thank you for your help.

Here is my site Read-Only: LINK
(how to share your site Read-Only link)

hi @slowandsteady and welcome. It is hard to say when I can’t see what is inside slides. Is it just single div? if yes you code should be

const slides = document.querySelector(".slides")

if you try to point all elements with class slides inside div

const slides = document.querySelectorAll(".slides")

Hi! Thanks for your help. That still didn’t solve my issue.

“slides” has 4 images inside of a div. like this:

This script is working in visual studio, but it’s not working in Webflow. I think I’m doing something wrong setting up inside of the Webflow platform. I’m just putting the script in the Before tag section of the page settings. Do I need to something additionally?

can you send Read only link to project?

it’s project 3

I’m trying to get an alert message when the image is clicked on.

hi @slowandsteady what page it is as I can’t find section that is on image?
edit: found it on Project 3 I should read text to end :grin:

Webflow section is created with div, not section tag.
That why your selector “section div.slides” is not working.

  • change section tag to … section
  • or change your selector to “.slides” or anything.

hi @slowandsteady here is short video how to feel free to download it as I will delete it when cleaning my Cloud space later.

Thank you so much for your help! I appreciate it so much!

hi @slowandsteady if your issue doesn’t persist feel free to close your request as solved