I'm still very new to html css and JS. I am trying to make an input field appear/toggle from a button click. here is my code so far.
HTML
<form>
<fieldset>
<legend>Competency 15 Event Listeners</legend>
<ol>
<li><button type="text" id="theButton" onclick="clickMe()">Click me!</button></li>
<li><input type="text" name="popup" id="popup"></li>
</ol>
</fieldset>
</form>
CSS
form{
width: 50%;
}
#popup {
display: none;
}
JavaScript
function clickMe(){
var text = document.getElementById("popup");
if (text.style.display === "none") {
text.style.display = "block";
} else {
text.style.display = "none";
}
}
I've looked all around the internet and can't seem to find the answer. Thanks in advance