jQuery UI & Slider: Range with fixed maximum

jQuery UI Slider – Range with fixed maximum

Fix the maximum value of the range slider so that the user can only select a minimum.

Set the range option to “max.”  

So now when you are selecting with the slide, you are selecting the minimum value.

<!doctype html>
<html lang='en'>
<head>
    <meta charset='utf-8'>
    <title>jQuery UI Slider - Range with fixed maximum</title>
    <link rel='stylesheet' href='//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css'>
    <script src='//code.jquery.com/jquery-1.10.2.js'></script>
    <script src='//code.jquery.com/ui/1.10.4/jquery-ui.js'></script>
    <link rel='stylesheet' href='https://codecrawl.com/code/jqueryui/jqueryui_style.css'>
    <script>
        $(function () {
            $('#slider-range-max').slider({
                range: 'max',
                min: 1,
                max: 10,
                value: 2,
                slide: function (event, ui) {
                    $('#amount').val(ui.value);
                }
            });
            $('#amount').val($('#slider-range-max').slider('value'));
        });
    </script>
</head>
<body>

<p>
    <label for='amount'>Minimum number of bedrooms:</label>
    <input type='text' id='amount' style='border:0; color:#f6931f; font-weight:bold;'>
</p>

<div id='slider-range-max'></div>

</body>
</html>
Try The Code Slider Widgets API Doc
Series Navigation<< jQuery UI & Slider: Snap to increment
jQuery UI & Slider: Vertical range slider >>