title: How to Capture user inputted text using JQuery?
body: <p>I have the following input element on the page:</p>
  
  <pre><code>Search: &lt;input id="example" /&gt;
  </code></pre>
  
  <p>I would like to capture the information the user enters in this box, when the user hits enter and display it on screen:</p>
  
  <pre><code>  $(window).keypress(function(e) {
        if(e.keyCode == 13) {
            $("input[name=example]").val().insertAfter('#example');
        }
  </code></pre>
  
  <p>The following results in an undefined:</p>
  
  <pre><code>$("input[name=example]").val() is undefined
  </code></pre>
  
  <p>How do you capture user inputed text?</p>