title: If Conditions on jquery ui slider
body: <p>I am trying to apply if..elseif.. condition on multiple UI sliders. Practically I want that certain slider show/hide depending on the <code>ui.value</code> but the if condition is not working correctly. A fiddle can be found here : <a href="http://jsfiddle.net/XWRDZ/" rel="nofollow">http://jsfiddle.net/XWRDZ/</a></p>
  
  <p>Code below:</p>
  
  <p>HTML<br /></p>
  
  <pre><code>&lt;div id="label"&gt;Postpaid&lt;/div&gt;&lt;br /&gt;
  &lt;div id="slider-range-max"&gt;&lt;/div&gt;
  &lt;br /&gt;
  &lt;div id="slider-range-max-2"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>JS</p>
  
  <pre><code>&lt;script&gt;
  var packageselection = 0;
  
   $(window).load(function() {
      $('#slider').hide(); 
      $('#slider-range-max-2').hide(); 
  });
  
    $(function() {
      var labelArr = new Array("Postpaid", "Hybrid", "SIM Only");
      $( "#slider-range-max" ).slider({
        min: 0,
        max: 2,
        value: 0,
        step: 1, 
        change: function( event, ui ) {
          $("#label").html(labelArr[ui.value]);
          packageselection = ui.value;
          if ( packageselection = 1 ){
                  $('#slider-range-max-2').show(); 
              }
          else if ( packageselection = 2 ){
                  $('#slider-range-max-2').hide(); 
              }   
        }
  
      }); 
    });
  
    $(function() {
      $( "#slider-range-max-2" ).slider({
        min: 1,
        max: 3,
        value: 1,
        slide: function( event, ui ) {
                  }
      });
    });
    &lt;/script&gt;
  </code></pre>
  
  <p>Thanks so much for your help guys!</p>