<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <div> <div id="text">Tekst her</div> <button onclick="change()">Trykk her</button> Vis dyr: <input id="showAnimal" onchange="show()"></button> <div id="show"></div> </div> <script> function change() { let animalList = ["hund", "katt", "esel"]; let animal = animalList[Math.floor(Math.random() * animalList.length)]; document.getElementById('text').innerHTML = `${animal}`; } function show(){ let animal = document.getElementById('showAnimal').value; document.getElementById('show').innerHTML = `${animal}`; } </script> </body> </html>