[Chartjs]-Running an onclick command to show a table in chartsJS

1👍

You are reasigning the onclick listener to the button in your show method. You just need to execute the code within it so your show method should be this:

if (document.getElementById("displaytable").style.display === "none") {
  document.getElementById("displaytable").style.display = "block";
} else {
  document.getElementById("displaytable").style.display = "none";
}

And you will need to target the correct table since you want to target a different table. But now since you get the same ID it will open and close the table you also open/close with the button

Leave a comment