title: jQuery: How can I assign a variable back to a hidden element in the document?
body: <p>How can I assign a variable (button id that was clicked), to the jQuery Diaglog, then back to the hidden element (myhiddenid) in the document for later use?</p>
  
  <pre><code>&lt;table border="0" class="time_data"&gt;
      &lt;td&gt;&lt;button type="button" id='001' class="del-fruit" &gt; Apple &lt;/td&gt;
      &lt;td&gt;&lt;button type="button" id='002' class="del-fruit" &gt; Banana &lt;/td&gt;
      &lt;td&gt;&lt;button type="button" id='003' class="del-fruit" &gt; Cantalope &lt;/td&gt;
  &lt;/table&gt;
  
  &lt;div id='myhiddenid' style="display:none;"&gt;&lt;/div&gt;
  
  &lt;script type="text/javascript"&gt;
  $("#dialog-form").dialog({
      autoOpen: false,
      height: 150,
      width: 350,
      modal: true,
      resizable: false,
      buttons: {
          'Yes': function() {
              var bValid = true;
              allFields.removeClass('ui-state-error');
  
              bValid = bValid 
  
              if (bValid) {
                  //the assining of myhiddenid should be here!!
                  //and should contain the ID of the button that i clicked.
                  $(this).dialog('close');
              }
          },
          No: function() {
              $(this).dialog('close');
          }
      },
      close: function() {
          allFields.val('').removeClass('ui-state-error');
      }
  });
  
  
  $('.del-fruit')
      .button()
      .click(function() {
      $('#dialog-form')
          .dialog( "option", "title", this.id )
          .dialog('open');
  });
  &lt;/script&gt;
  </code></pre>