title: How to change the value of jquery slider in the "slidechange" event withouth triggering another "slidechange" event
body: <p>i've been stuck in this loop for a while. Basically i have a slider that performs some action when the slider values changes. First thing i do is make a check, and if that check doesn't pass, i need to reset the value of the slider. But resetting the value of the slider changes it!And so i'm stuck. Here is my code:</p>
  
  <p>Slider:</p>
  
  <pre><code>    $(element).slider({
          min: 0,
          max: 10,
          step: 1,
          value: initialValue,
          animate: false,
          slide: _updateOnSlide,
          change: _performAction
      }); 
  
  var _performAction = function(evt, ui){
      if (CT.travel.atLeastOneStepPresent()){
          var id = $(this).attr("id");
  
          _updateOnSlide(evt, ui);
  
          if (id != "travelTime"){//se è il tempo non aggiorno
  
  
              CT.makeQuery();
  
          }
          CT.timeline.update();
      }else{
          alert("you can't do this");
          $(this).slider("value", 0);
          _updateOnSlide(evt, ui);
      }
  }
  </code></pre>
  
  <p>The problem is that <code>$(this).slider("value", 0);</code> triggers another change event!
  Anyone knows how to solve this?</p>
  
  <p>I need to use the change function because i'm changing the values of the slider by clicking buttons, not by sliding it.</p>
  
  <p>EDIT - evt.originalEvent is always undefined for me (if i cosole.log it like this console.log(evt.originalEvent)) but for some strange reason i see it if i console.dir it. But unfortunately it doesn't solve the problem, i add here the part of my code that vhanges the value of the slider (pardon me i forgot to do that earlier)</p>
  
  <pre><code>            $('.plus').click(function(event){
                  var sliderCurrentValue = $( this ).next().slider( "value" );
                  $(this).next().slider( "value", sliderCurrentValue + 1 );
              });
  </code></pre>
  
  <p>As you can see, the value is changed programmatically the first time and so the check on the evt.originalEvent would be useless anyway.</p>
  
  <p>EDIT 2 - i've found a way out of this but i hope there is a better way:</p>
  
  <pre><code>        alert("you can't do this");
                      //destroy the slider
          $(this).slider("destroy");
                      // recreate the slider
          _makeSelector(this);
  </code></pre>
  
  <p>I think it could also work if i just removed the function binded to the "change" event and reset the value, but i hope there is a better way of doing this!</p>