Jquery slider

Jquery slider

Hi there,

I'm just exploring the use of the jquery slider and am keen to make use of the "disabled" functionality. Basically what I want is if a boolean checkbox is unticked (true) then the slider is disabled and enabled when the checkbox is ticked.

I've read and attempted to implement the following ( http://jqueryui.com/demos/slider/#option-disabled) to no avail. My code is as follows:

  1. <script>
  2. $(function() {
  3. $( "#slider-range" ).slider({
  4. range: true,
  5. min: 0,
  6. max: 500,
  7. values: [ 75, 300 ],
  8. slide: function( event, ui ) {
  9. $( "#amount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] );
  10. }
  11. });
  12. $( "#amount" ).val( "$" + $( "#slider-range" ).slider( "values", 0 ) +
  13. " - $" + $( "#slider-range" ).slider( "values", 1 ) );
  14.    $( "#active" ).slider( "option", "disabled" );
  15. });
  16. </script>

  17. <p>
  18.         <input type="checkbox" id=  "active" name="active" />
  19. <label for="amount">Price range:</label>
  20. <input type="text" id="amount" style="border:0; color:#f6931f; font-weight:bold;" />
  21. </p>
  22. <div id="slider-range"></div>

I'm also keen to set the maximum and minimum values using a textbox but I think that the logic will be the same as the disable bit using:

  1. $( ".selector" ).slider( "option", "max", 7 );
Any clues or tips would be hugely appreciated,
Aaron