293
Views
2
Comments
Solved
How to assign an id to an element

I am writing a memory cards game and faced a problem.

When I click on card, I want it to flip.

In a script I want to GetElementById, but I don't know where to get this id, or how to assign an id to the container where the card is?


Thanks.

2021-06-02 20-50-04
Márcio Carvalho
Solution

You must name the element, and then you can assign it to the javascript with an input parameter, the id


When inside the javascript block, create an input parameter to pass the element identifier.

2022-05-29 13-15-09
Valentyna Boiko

Thank you for your quick answer, Márcio 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.