title: How to set the value of an element in JQuery UI Dialog
body: <p>I currently reside with a problem where I need to pass a value to a Jquery UI Dialog, but I have no idea how. I have checked around for documentation everywhere, but nothing seems to work. This is what I have (and have tried)</p>
  
  <p>Actual Dialog:</p>
  
  <pre><code>    &lt;div id="amountDialog" title="Add to Basket"&gt;
          &lt;table style="text-align: center"&gt;
              &lt;tr&gt;
                  &lt;td colspan="2"&gt;
                      &lt;p id="productAdd"&gt;&lt;/p&gt; &lt;!-- need to set this value --&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt;
                      &lt;input type="text" id="modalInputAmount" /&gt;
                  &lt;/td&gt;
                  &lt;td&gt;
                      &lt;p id="maxAmt"&gt;Maximum Amount: &lt;/p&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>Dialog Options:</p>
  
  <pre><code>$( "#amountDialog" ).dialog({ 
                          autoOpen: false, 
                          width: 'auto',
                          modal: true,
                          buttons : {
                              "OK" : execute
                          },
                          open : function (event, ui) {
                              $("#productAdd").val('How many [' + item + ']\'s do you wish to add to the basket?"'); &lt;!-- item is the global variable describing which item is added to the basket --&gt;
                          }
                      });
  </code></pre>
  
  <p>Opening code</p>
  
  <pre><code>    $("#amountDialog" ).dialog("open");
  </code></pre>
  
  <p>I won't bother pasting the execute code here as I know that works, I can get the value from the textbox in the modal dialog. My concern however is, how do I set the value of the <code>#productAdd</code> paragraph when the modal dialog opens?</p>
  
  <p>Just need to put this out there again, I am still a newbie with JQuery.</p>