10. Data Attributes πŸ‘©β€πŸŽ“πŸ‘¨β€πŸŽ“

πŸ—οΈ Use Data Attributes to Display Hidden Number

  • As a player, I want to click on a card and view the hidden number.

Acceptance Criteria

  • It’s done when I click on a card and the hidden number is revealed.

  • It’s done when the number is visible if the card is clicked.

Assets

The following image demonstrates the web application’s appearance and functionality:

Six cards appear in a grid, with the numbers 1, 3, and 5 displayed on three of the cards while the remaining three appear blank.


πŸ’‘ Hints

How can we use the dataset object to access an element’s data attributes?

πŸ† Bonus

If you have completed this activity, work through the following challenge to further your knowledge:

  • We have learned getAttribute() and setAttribute(). What other methods can you use to access an element’s attributes?

Use Google or another search engine to research this.


βœ… Solutions

Solutions Click Here