Q: java script .createelement('''button") issue I want to take information from another java script data file and when I click on the button "kingdom" another buttons to be created and the information for them to be given from the other data file.
Here is my code but it doesn't work properly:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="Taxonomy.js"></script>
<script type="text/javascript" src="Page.html"></script>
</head>
<body>
<button type="button" id="kingdom" style="position:absolute;left:700px;" 
onclick="tree()"></button>
<script type="text/javascript">
var mydata=Taxonomy;
document.getElementById("kingdom").innerHTML=mydata[0][2];
let isitshown;
function tree() {
for(let i=0;i<mydata.length;i++){
if(mydata[i][2]=="phylum"){
let n=document.createElement("button");
n.innerHTML=mydata[i][3];
}
}

}
 </script>
 </body>
 </html>

and here is part of my data file:
var Taxonomy = [
[36064765,0,"kingdom","Plantae"],
[36064766,36064765,"phylum","Tracheophyta"],
[36064767,36064766,"class","Magnoliopsida"],
[36064768,36064767,"order","Fagales"],
[36064769,36064768,"family","Nothofagaceae"],
[36064880,36064767,"order","Ericales"],
[36064881,36064880,"family","Scytopetalaceae"],
[36065385,36064767,"order","Garryales"],
[36065386,36065385,"family","Eucommiaceae"],
[36065387,36064767,"order","Saxifragales"],
[36065388,36065387,"family","Penthoraceae"],
[36065805,36064767,"order","Malpighiales"],
[36065806,36065805,"family","Chrysobalanaceae"],
[36065807,36064767,"order","Myrtales"],
[36065808,36065807,"family","Myrtaceae"],
[36065809,36065805,"family","Irvingiaceae"],
[36066064,36064880,"family","Napoleonaceae"],
[36066187,36064767,"order","Caryophyllales"],
[36066188,36066187,"family","Droseraceae"],
[36066189,36064766,"class","Cycadopsida"],
[36066190,36066189,"order","Cycadales"],
[36066191,36066190,"family","Zamiaceae"],
[36066205,36064767,"order","Fabales"],
[36066206,36066205,"family","Fabaceae"],
[36066219,36066190,"family","Cycadaceae"],
[36066239,36064765,"phylum","Marchantiophyta"],
[36066240,36066239,"class","Marchantiopsida"],
[36066241,36066240,"order","Marchantiales"],


A: let n = document.createElement("button"); only stores the element in the variable n, it doesn't add it to the page. You also have to add it to the body with document.body.append(n);
