Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<p>I'm thinking of a letter. Guess which: a, b, c, d or e?</p>
<input id="myInput" type="text">
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
  var letter = document.getElementById("myInput").value;
  var text;
  // If the letter is "c"
  if (letter === "c") {
    text = "Spot on! Good job!";
    
  // If the letter is "b" or "d"
  } else if (letter === "b" || letter === "d") {
    text = "Close, but not close enough.";
    
  // If the letter is anything else
  } else {
    text = "Waaay off..";
  }
  document.getElementById("demo").innerHTML = text;
}
</script>
</body>
</html>