We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

How to Access the ID of a clicked HTML Element

Home Forums Puzzles How to Access the ID of a clicked HTML Element

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #34034
    eabrosius
    Participant

    I have a list of text strings that represent the ID’s of all of the HTML elements that I have created on a webpage (using Webflow to create the HTML elements).

    I am able to create an event listener for this list which triggers whenever I click on any element whose ID is in the list (see attached screenshot), but I can’t figure out how to access the specific ID of the element that was clicked.

    Do I need to just create a separate event listener for each element and hard-code the name of the element ID, or is there a more efficient way to do this with a list of IDs? Need to use custom JS code instead of puzzles to accomplish this maybe?

    Thanks.

    Eric

    Attachments:
    You must be logged in to view attached files.
    #34038
    felipege
    Participant

    I don’t think the list is necessary , try this puzzle setup

    it will print any ID that you click.

    Attachments:
    You must be logged in to view attached files.
    #34040
    eabrosius
    Participant

    Thank you! Sorry for the rookie question. Still getting familiar with all of the available puzzle options. Glad you were willing to help!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.