I'm trying to get user's input with an input tag and when the user types a specific word it will change the display on css so it'll make it appear. Seems like what I tried is wrong. Does anyone know how I can make this work?
var input = document.getElementById("ter").value;
if (input == "ls") {
document.getElementById("pages").style.display = "block";
}
...
div#main {
position: absolute;
top: 50px;
left: 0;
right: 0;
text-align: center;
}
div#pages {
display: none;
}
input {
background: transparent;
border: none;
color: #c0c0c0;
width: 50%;
height: 30%;
margin-left: 10px;
}
input:focus {
outline: none;
}
p#term-text {
font-weight: bold;
color: #00ff00;
}
...
...
<div id="main">
<p id="term-text">usr@test:~<input type="text" name="terminal" id="ter"></p>
<div id="pages">
<p>If user types ls on input this will appear</p>
</div>
</div>
...