title: JQUERY input field value to be stored in a variable
body: <p>I am unable to capture the value typed by a user in the textbox into a variable.</p>
  
  <p>I do not want to use <code>&lt;form&gt;</code>, is there any other way to do this?</p>
  
  <pre><code>   &lt;html&gt;
     &lt;head&gt;
     &lt;style&gt;
  
       p { color:blue; margin:8px; }
       &lt;/style&gt;
       &lt;script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt;
     &lt;/head&gt;
     &lt;body&gt;
     &lt;input type="text" id="txt_name"  /&gt;
  
     &lt;script type="text/javascript"&gt;
     value = $("#txt_name").val(); 
     $("#dom_element").text(value);
     &lt;/script&gt;
  
     &lt;/body&gt;
     &lt;/html&gt;
  </code></pre>