How to display data from the nested object based on click event


#1

I have an array with 3 objects inside. Each object has 4 properties.

In my html I have 3 buttons, each one connected to the given object.

How can I display data for the given object based on the clicked button?

Here is a snippet with my code:

https://jsfiddle.net/marektchas/rqjxpav2/1/


#2

You should use the click event of the buttons, every time a click is made pass the button information to a variable and display that info in your html.

Here is an example:

https://jsfiddle.net/zsxajyuk/