title: Jquery UI Slider set value dynamically on sliding the slider
body: <p>I'm using jquery slider , If I slide the slider,In slide function 
  I will test certain scenario . If the scenario is not satisfied the slider should be positioned back to its original position . </p>
  
  <p><strong>For example :</strong> </p>
  
  <p>The current slider value is 1 and the user slide it to value 2, in slide: function (event, ui) function I'm checking the condition if not satisfied the value of the slider should be reverted back to value 1 . </p>
  
  <p>So that I have used the code in else part </p>
  
  <p>$("#slider").slider({ value: parseFloat(return_slider_value) });<br>
   $("#slider").slider('value', 1);</p>
  
  <p>It is not setting back the value 1 still it shows the value 2 in the slider.</p>
  
  <p>My requirement is the value of slider value should be dynamically changed .</p>
  
  <pre><code>var slider_Value = $.trim(data.details.merchant_table_booking_hours);
  if (slider_Value == '') 
  {
    slider_Value = 0;
  }
  var return_slider_value = slider_Value;
  $("#slider").slider({
  value: slider_Value,
  min: 0,
  max: 12,
  step: 0.5,
  slide: function (event, ui) 
  {
      var selected_button_count = 0;
      $(".time_slot_buttons").each(function () 
      {
          if(this.attr('selected-id')==0)
          {
              selected_button_count = parseInt(selected_button_count)+1;
          }
      });
      if (selected_button_count&gt;0)
      {
          if (parseFloat(ui.value) != 0) 
          {
              $("#slider-value").val(ui.value);
              $("#show-slider-hrs").html(ui.value + " hrs ");
          } else 
          {
              $("#slider-value").val('');
              $("#show-slider-hrs").html('');
          }
      }
      else
      {
          alert("Please Select a Floor And Timing Buttons" + return_slider_value);
          $("#slider-value").val(return_slider_value);
          $("#show-slider-hrs").html(return_slider_value + " hrs ");
          $("#slider").slider({ value: parseFloat(return_slider_value) });                                                                 
          $("#slider").slider('value', 1);
      }
  }
  })
  </code></pre>
  
  <p>Thanks in advance .</p>