Event Handling

<input type="text" id="inputBox" placeholder="Type something">
<p id="output"></p>

<script>
$(document).ready(function(){
  $("#inputBox").keyup(function(){
$("#output").text("You typed: " + $(this).val());
}); }); </script>

.keyup() fires every time you release a key.
.val() gets the input value.
.text() updates paragraph text.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *