I'm trying to get a specific out put based on what is in the text box, with java script but all the code I'm using only works for numbers not with "text". When I replace the numbers with "text" it outputs no matter whats in the text box.
<!DOCTYPE html>
<html>
<body>
<imput id="x"value=""/>
<button on Click="myFunction():">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var qpw = "eighteen";
var w = (qpw = "eighteen") ? "dieciocho":"no caps";
document.getElementByld("demo").innerHTML = w + "";
}
</script>
<script>
function myFunction() {
var qpe = "blue";
var e = (qpe = "blue") ? "azul":"no caps";
document.getElementByld("demo").innerHTML = e + "";
}
</script>
</body>
</html>