Dom/js länk byta text
Hej!
Har en uppgift i skolan där jag har en a href länk där det står click here och efter amn klickat där ska man har gjort en p tag där texten you clicked dyker upp under länken.
detta är min js kod i min app.js fil
function myFunction() {
let x = document.getElementById('step05').text = "you clicked!";
document.getElementById('demo').innerHTML = x;
}
detta är min html kod i index.html
<div id="step05">
<h2>Exercise 5</h2>
<p>
Create and display a p-element containing the text "You clicked!" when the user
clicked the grey box below.
</p>
<div class="greybox"><a href="#" onclick="myFunction()">Click me!</a></div>
<p id="demo"></p>
</div>
Vad är det för fel jag gör? Varför fungerar det inte?