title: Saving temporary form information in global Javascript variables
body: <p>Is there any reason why I shouldn't do something like the following (to avoid using a hidden field to store the temporary information)? I'm using jQuery syntax for brevity but it's a general JavaScript question.</p>
  
  <pre><code>function editComments() {
      window.currentComments = $('#commentsTextBox').val();
      $('#commentsTextBox').removeAttr("readonly");
  }
  
  function cancelEditComments() {
      $('#commentsTextBox').val(window.currentComments);
      $('#commentsTextBox').attr("readonly", "readonly");
  }
  </code></pre>
  
  <p>I know that globals are generally considered bad practice, but is there really any problem with doing the above?</p>
  
  <p>Please don't answer/comment with "globals variables are evil" unless you can give a reason/explanation. </p>