title: how to read input from text input field and put input into div
body: <p>I am trying to run this code.
  the code should take a string as input and put that input to a div and calculate the width of the div.</p>
  
  <p>here is code i have used.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;script src="http://code.jquery.com/jquery-1.9.1.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;input type="text" value="" name="input"&gt;
  &lt;input type="submit" value="submit" name="submit"&gt;
  
  &lt;script&gt;
  var elem = '&lt;div id="divitem" style="width:auto;"&gt;&lt;/div&gt;';
  $('body').append($(elem));
  $("submit").click(function () {
  var text = $(this).text();
  value= $("input").val(text);
  alert(value);
  });
  
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>but i am not getting any output. how to do this?
  please help me.</p>