I am creating a poem with blank lines. The blank must be changed and I have javascript created to check if the word that is entered is the correct word that should be in the poem.
Anyone know what I am doing wrong?
<body>
<pre id="poem">
Social Media
Relax yourself,
As I <span id = "word1" contenteditable>______</span>
through your mind
Scroll down the pages
of your spine
Reading every word
and thought on
your <span contenteditable>____</span> like a <span contenteditable>____</span>
Stumbled Upon
you then <span contenteditable>_______</span> onto
your looks--IGuess
I'm <span contenteditable>______</span> into you
You're my one
and only <span contenteditable>________</span>
Will you <span contenteditable>______</span> me?
</pre>
<button onsubmit = "isCorrect()"> submit </button>
<p color = "white" id = "demo"></p>
</body>
Javascript:
<script>
function isCorrect(){
var word = document.getElementById("word1").value;
if (word == "dig")
{
document.getElementById("demo").innerHTML = word;
}
}
</script>