javascript - 从提交和页面加载后保留范围值
问题描述
我正在研究价格范围滑块。当用户选择价格范围时,我正在提交价格范围滑块更改表格。但是在提交表单并加载页面后,滑块值会被重置。下面是代码 -
<div class="form-group">
<div class="price-slider">
<span><label for="">Price from</label>
<input readonly name="priceFrom" id="priceFrom" type="number" value="200000" min="200000" max="1000000"/>
<label for="">Price to</label>
<input readonly name="priceTo" id="priceTo" type="number" value="1000000" min="200000" max="1000000"/></span>
<input value="200000" min="200000" max="1000000" step="500" type="range"/>
<input value="300000" min="300000" max="1000000" step="500" type="range"/>
</div>
</div>
在价格范围滑块上提交表单的代码是 -
<script>
jQuery(document).ready(function($){
$('input[type=range]').change(function() {
$("form#search-form").submit();
});
});
</script>
在表单提交和页面加载后,有什么方法可以保留用户选择的范围值?任何帮助将不胜感激。谢谢你。
解决方案
推荐阅读
- html - PayPal 和表单订购 HTML
- javascript - 图像防盗保护,下载时更换图像
- node.js - Angular,从承诺中提取价值
- python - 熊猫 .loc 和 PEP8
- reactjs - 在子组件的useEffect之前触发父组件的useEffect
- arrays - C:在数组上打印 INT 值 - 如何停止在 NULL 值上打印?
- android - Android/Kotlin - okhttp4 GET 请求 - 返回响应标头而不遵循重定向
- autohotkey - 带计时器的多个循环
- ansible - Ansible、module_defaults 和包模块
- sql - 在 Bigquery 中将秒转换为天、小时、分钟