Modified Slider UI with 2 hidden inputs and showing value in html.
I've made a modified version for Range Slider UI . You can use 2 hidden Inputs. In each hidden input is 1 value and values is also in html with live changing. Here is the code if anyone wants it , you can use it.If you know a better solution for this, don't hesitate and post it to comments.Together we can make it better. I am begginer so take a look at it.
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>jQuery UI Slider - Range slider</title>
- <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
- <script src="../../../jquery-1.7.2.min.js"></script>
- <script src="../../ui/jquery.ui.core.js"></script>
- <script src="../../ui/jquery.ui.widget.js"></script>
- <script src="../../ui/jquery.ui.mouse.js"></script>
- <script src="../../ui/jquery.ui.slider.js"></script>
- <link rel="stylesheet" href="../demos.css">
- <style>
- #demo-frame > div.demo { padding: 10px !important; }
- #text_price {
- padding-bottom:5px;
- }
- </style>
- <script>
- $(function() {
- $( "#slider-range" ).slider({
- range: true,
- min: 0,
- max: 500,
- values: [ 75, 300 ],
- slide: function( event, ui ) {
- $( "#amount_1" ).val( ui.values[ 0 ] );
- $( "#amount_2" ).val( ui.values[ 1 ] );
- $( "#amount_1_show" ).text( ui.values[ 0 ] );
- $( "#amount_2_show" ).text( ui.values[ 1 ] );
- }
- });
- $( "#amount_1" ).val( $( "#slider-range" ).slider( "values", 0 ) );
- $( "#amount_2" ).val( $( "#slider-range" ).slider( "values", 1 ) );
-
- $( "#amount_1_show" ).text( $( "#slider-range" ).slider( "values", 0 ) );
- $( "#amount_2_show" ).text( $( "#slider-range" ).slider( "values", 1 ) );
- });
- </script>
- </head>
- <body>
- <div class="demo" style="width:300px;position:absolute;font-size:12px;">
- <div id="text_price">
- Price range:
- <span id="amount_1_show" style="color:#f6931f; font-weight:bold;"></span> -
- <span id="amount_2_show" style="color:#f6931f; font-weight:bold;"></span>
- </div>
-
- <input type="hidden" id="amount_1" style="border:0; color:#f6931f; font-weight:bold;" />
- <input type="hidden" id="amount_2" style="border:0; color:#f6931f; font-weight:bold;" />
- <div id="slider-range"></div>
- </div>
- </body>
- </html>