All docs
V23.2
24.1
23.2
23.1
22.2
22.1
21.2
21.1
20.2
20.1
19.2
The page you are viewing does not exist in version 19.2.
19.1
The page you are viewing does not exist in version 19.1.
18.2
The page you are viewing does not exist in version 18.2.
18.1
The page you are viewing does not exist in version 18.1.
17.2
The page you are viewing does not exist in version 17.2.

jQuery RangeSlider - Handle the Value Change Event

To process new RangeSlider values, you need to handle the value change event. If the handling function is not going to be changed during the lifetime of the UI component, assign it to the onValueChanged property when you configure the UI component.

jQuery
JavaScript
$(function() {
    $("#rangeSliderContainer").dxRangeSlider({
        onValueChanged: function (e) {
            const newStartValue = e.start;
            const newEndValue = e.end;
            // Event handling commands go here
        }
    });
});
Angular
HTML
TypeScript
<dx-range-slider
    [(start)]="startValue"
    [(end)]="endValue"
    (onValueChanged)="handleValueChange($event)">
</dx-range-slider>
import { DxRangeSliderModule } from "devextreme-angular";
// ...
export class AppComponent {
    startValue = 20;
    endValue = 60;

    handleValueChange (e) {
        const newStartValue = e.start;
        const newEndValue = e.end;
        // Event handling commands go here
    };
}
@NgModule({
    imports: [
        // ...
        DxRangeSliderModule
    ],
    // ...
})
Vue
<template>
    <DxRangeSlider 
        v-model:start="startValue"
        v-model:end="endValue"
        @value-changed="handleValueChange"
    />
</template>

<script>
import 'devextreme/dist/css/dx.light.css';

import { DxRangeSlider } from 'devextreme-vue/range-slider';

export default {
    components: {
        DxRangeSlider
    },
    data() {
        return {
            startValue: 20,
            endValue: 60
        };
    },
    methods: {
        handleValueChange(e) {
            const newStartValue = e.start;
            const newEndValue = e.end;
            // Event handling commands go here
        }
    }
}
</script>
React
import React from 'react';
import 'devextreme/dist/css/dx.light.css';

import { RangeSlider } from 'devextreme-react/range-slider';

class App extends React.Component {
    constructor(props) {
        super(props);

        this.state = {
            startValue: 20,
            endValue: 60
        };
        this.handleValueChange = this.handleValueChange.bind(this);
    }

    handleValueChange(e) {
        const newStartValue = e.start;
        const newEndValue = e.end;
        // Event handling commands go here

        this.setState({
            startValue: newStartValue,
            endValue: newEndValue
        });
    }

    render() {
        return (
            <RangeSlider
                start={this.state.startValue}
                end={this.state.endValue}
                onValueChanged={this.handleValueChange}
            />
        );
    }
}

export default App;
jQuery

If you are going to change event handlers at runtime, or if you need to attach several handlers to the value change event, subscribe to this event using the on(eventName, eventHandler) method.

JavaScript
const valueChangedHandler1 = function (e) {
    const newStartValue = e.start;
    const newEndValue = e.end;
    // First handler of the "valueChanged" event
};

const valueChangedHandler2 = function (e) {
    const newStartValue = e.start;
    const newEndValue = e.end;
    // Second handler of the "valueChanged" event
};

$("#rangeSliderContainer").dxRangeSlider("instance")
    .on("valueChanged", valueChangedHandler1)
    .on("valueChanged", valueChangedHandler2);
See Also