Note that there are some explanatory texts on larger screens.

plurals
  1. PONot possible to update individual elements within an open jQuery UI dialog?
    primarykey
    data
    text
    <p>I'm creating a dialog to show the status of a long running process. Basically, I want to create the dialog, and update the contents as the long running process executes. I'm still pretty new to jQuery/jQuery UI, so I'm probably doing something dumb, but I don't understand why the following does not work:</p> <pre><code> function updateStatus() { $('#status').html("Interval status!"); $('#message').html("message status!"); } ... var $updateDialog = $('&lt;div id="updateDialog">&lt;/div>') .html('&lt;table>&lt;tr>&lt;td id="status">Status goes here ...&lt;/td>&lt;/tr> &lt;tr>&lt;td>&nbsp;&lt;/td>&lt;/tr> &lt;tr>&lt;td id="message">Message goes here ...&lt;/td>&lt;/tr> &lt;/table>') .dialog({ title: 'Update Progress', modal: 'true', buttons: { "OK" : function() { $(this).dialog("close"); clearInterval(interval); } } }); interval = setInterval(updateStatus, 1000); </code></pre> <p>When updateStatus gets called, I expect to see the &lt;td> elements updated to the new values, but the content is not changed. If I do something like $('#status').html() and write it to the console, it shows that it <em>is</em> changed; but the change is not visible in the dialog.</p> <p>However, if I completely replace the entire html() for the dialog, the contents of the dialog is visible.</p> <pre><code> $('#updateDialog').html('&lt;table>&lt;tr>&lt;td id="status">Interval Status ...&lt;/td>&lt;/tr> &lt;tr>&lt;td>&nbsp;&lt;/td>&lt;/tr> &lt;tr>&lt;td id="message">Interval message ...&lt;/td>&lt;/tr> &lt;/table>') </code></pre> <p>I'd rather use the more "surgical" approach of updating the individual elements if I can. Can somebody tell me what I'm missing here?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload