I have 2 dropdown list : 1 to select a Team and another 1 linked to the first one to select a player.
I look at the selection of the second one with this code :
if (TeamA === "optionA1") {
contenu.innerHTML = "<span style='font-size: 12px; text-align: left; position: relative; top: -332px; left: -425px;'>Player1</span>";
Instead of printing “Player1” i would like to show a table which look like the image i attached.
The table is generated by a script in R so i can’t copy paste the code. The script include a structure of a Rmarkdown so when i run my script a rmarkdown is knited automatically into a html. I want the table to be shown in the html by dynamically : if i change the selection of the player i will show another table.
I read that i need to convert my table created with R code to a format which will be readable by the js i used to create my dropdown liste.
I’ve tried to use jsonlite::toJSON or JSON.stringify but it’s not working.
For example i’ve tried this code, but the table isn’t showing on my html :
if (TeamA=== "optionA1") {
var statsJoueurJSON1 = JSON.stringify(df_stats_joueurs_1);
contenu.innerHTML = "<span style='font-size: 12px; text-align: left; position: relative; top: -332px; left: -425px;'>" + statsJoueurJSON1 + "</span>";
No error message however
Leo Faytre is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.