title: jQuery Define a Global Variable for an element that does not yet exist in DOM
body: <p>I'm working on a page where user can create a form by clicking to insert  fields. Initially no input elements exist on the page. User clicks to created them. I'm trying to create Global variables to reference those input fields so i can later make use of this, but since input fields do not initially exist in DOM, the global variable is giving undefined. Anyway way around this. I want the variables to be global, because i want to make use of them in other functions.</p>
  
  <p>Ex:</p>
  
  <pre><code>var $selected = $('#form').find('.selected input').val(); //Global variable outside the function. Since this doesn't initially exist in DOM, it's giving undefined. 
  </code></pre>