Skip to content Skip to sidebar Skip to footer

Read Price Suffering Values

Got the price range with the ui jquery plugin.I want to read the lowest and highest price range in javascript i used these codes.But it does not read minamout and maxamount. How ca

Solution 1:

You can read min and max values inside slide event handler of the slider and use $( "#slider" ).slider( "option", "values" ) to read values.

you can create array of min amount and max amount values and set it to slider

see below code

$(function(){
var minAmount = 1000;
var maxAmount = 4005000;
const numberFormat = newIntl.NumberFormat();
        $("#slider").slider(
            {
                range: true,
                values: [1000, 4005000],
                min: 1000,
                max: 4005000,
                step: 10000,
                slide: function (event, ui) {
                     var values = $( "#slider" ).slider( "option", "values" );
                     $('#min').html(values[0]);
                     $('#max').html(values[1]);
                // set min and max values in variable which you can read to any other function
                minAmount = values[0];
                maxAmount = values[1];
                }
            }
        );
     // push min and max values and set it to slidervar min = 200000;
     var max = 3100000;
     var valuesArray = [min, max];
     $( "#slider" ).slider( "option", "values", valuesArray );
 });
<linkrel="stylesheet"href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"><linkrel="stylesheet"href="/resources/demos/style.css"><scriptsrc="https://code.jquery.com/jquery-1.12.4.js"></script><scriptsrc="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script><divid="slider"></div><divid="min"></div><divid="max"></div>

Post a Comment for "Read Price Suffering Values"