简体   繁体   English

如何为 ion.rangeSlider 设置默认值

[英]How can I set a default value for ion.rangeSlider

Could you help me to set the default value to my input?你能帮我为我的输入设置默认值吗?

As I submit the range that within the form it always take the min to max and it does not care about the default value that I put it in the input value.当我提交表单内的范围时,它总是取最小值到最大值,它不关心我把它放在输入值中的默认值。

How can I solve this problem?我怎么解决这个问题?

    <input type="text" class="js-range-slider clicked"  id="rangeme" name="Project_Cost" value="-1" /> 
        <script>
            $(".js-range-slider").ionRangeSlider({
                type: "double",
                min: 0,
                max:<?php  echo $max;?>,
                from: 0,
                values:$(this).find('.clicked').val(),
                to: <?php  echo $max;?>,
                grid: true
            });                      
        </script>

Just check this default demo只需检查这个默认演示

http://ionden.com/a/plugins/ion.rangeSlider/demo.html http://ionden.com/a/plugins/ion.rangeSlider/demo.html

you need to put default variable using "from" parameter (in demo example from is 550 so on start 550 is selected), in your code from is 0 so slider is always on min which is also 0您需要使用“from”参数放置默认变量(在演示示例中 from 是 550,所以在开始时选择 550),在您的代码中 from 是 0 所以滑块总是在 min 上,这也是 0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM