Skip to content
Related Articles

Related Articles Sliders sliderValue Option
  • Last Updated : 20 Nov, 2020
GeeksforGeeks - Summer Carnival Banner

The library is a cross-browser library that aims to improving the user interface of a website. The Slider controls are thin tracks that allow the user to input values. It is done by defining a range of values that can be selected by the user by dragging the handle to the appropriate value.

The Sliders sliderValue option is used to define the initial value that the slider handle would be set. This is only followed when the given value is within the range of the values that the slider is allowed to represent.


{ sliderValue: value }


  • value: This is a number that will be the initial value of the slider. The default value is 0.



<!DOCTYPE html>
    <!-- Include the required scripts -->
    <script type="text/javascript" 
    <script type="text/javascript" 
        src="scriptaculous.js?load = slider">
    <!-- Style the Sliders so that they
        are properly visible -->
    <style type="text/css">
        .track {
            width: 250px;
            background-color: gray;
            height: 5px;
            position: relative;
        .track .handle {
            width: 20px;
            height: 10px;
            background-color: green;
            cursor: move;
            position: absolute;
            top: -2px;
        .pad {
            padding: 25px;
    <h1 style="color: green;">
    <h2>Sliders sliderValue</h2>
        The slider has been initially set
        to the values mentioned in the
        sliderValue option
    <div class="pad">
        <div id="track-hor" class="track">
            <div id="handle-hor" class="handle">
    <div class="pad">
        <div id="track2-hor" class="track">
            <div id="handle2-hor" class="handle">
    <script type="text/javascript">
        new Control.Slider('handle-hor',
            'track-hor', {
            range: $R(1, 10),
            // Set the initial value
            // of the slider
            sliderValue: 7.75,
        new Control.Slider('handle2-hor',
            'track2-hor', {
            range: $R(1, 10),
            // Set the initial value
            // of the slider
            sliderValue: 2,



My Personal Notes arrow_drop_up
Recommended Articles
Page :