Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Edited to reflect new understanding of the question</strong></p> <p><s>What you want to do is pass a callback function for the change event, like this:</s></p> <p>What I now understand is that you want to trigger a change event when you change the value of the slider. You set the value programmatically somewhere with:</p> <pre><code>$('div[name="FirstSliderselector"]').slider('value', $('#MasterSlider').slider('value')); </code></pre> <p>In order for your <code>for</code> loop to execute after you've done this, you will need to have bound a change event to the slider, like this:</p> <pre><code>$('div[name="FirstSliderselector"]').slider({ change: function (event, ui) { var firstSliders = $('div[name="FirstSliderselector"]'), i; for (i = 0; i &lt; firstSliders.length; i += 1) { console.log(ui.value); } } }); </code></pre> <p>You can also do it like this:</p> <pre><code>$('div[name="FirstSliderselector"]').on('slidechange', function (event, ui) { var firstSliders = $('div[name="FirstSliderselector"]'), i; for (i = 0; i &lt; firstSliders.length; i += 1) { console.log(ui.value); } }); </code></pre> <p>If you want to make sure this is only triggered when the value change is done programmatically and not after the slider slides, your callback function becomes this:</p> <pre><code>function (event, ui) { if (!event.originalEvent) { var firstSliders = $('div[name="FirstSliderselector"]'), i; for (i = 0; i &lt; firstSliders.length; i += 1) { console.log(ui.value); } } } </code></pre> <p>And finally, if none of these satisfy your needs, there is always, as suggested by Chris GW Green, the when-done construct:</p> <pre><code>$.when($('div[name="FirstSliderselector"]').slider('value', $('#MasterSlider').slider('value'));).then(function () { var firstSliders = $('div[name="FirstSliderselector"]'), i; for (i = 0; i &lt; firstSliders.length; i += 1) { console.log('for loop executed'); } }); </code></pre>
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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