title: Return of value on keyup with Jquery
body: <p>With this code, the console display "ReferenceError: myVar is not defined".
  If I initialize the variable before the function, it value doesn't change after.
  What's wrong ?</p>
  
  <p>Thank's to help me !</p>
  
  <pre><code>$('#origVal').keyup(function ()
  {
      myVar = $('#origVal').val();
  });
  console.log(myVar);
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I try to recover the text that was entered in an input with keyup.
  The goal is to give to dat.gui the contents recovered to display it in 3D with three.js. I know maybe I'm wrong with the way to do that...</p>
  
  <pre><code>&lt;body&gt;
      &lt;input type='text' id='origVal'&gt;
      &lt;script&gt;
          var myVar = "";
          $('#origVal').keyup(function ()
          {
              myVar = $('#origVal').val();
          });
          document.write(myVar); //It doesn't work !
          var guis = {
              TextGeometry : function( mesh )
              {
              var data = {
              text : myVar, //It doesn't work !
           ...
      &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>