"How to change the input type range value after entering the value in the input box?"
Bootstrap 4.1.1 Snippet by muhittinbudak

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="row"> <h2>Create your snippet's HTML, CSS and Javascript in the editor tabs</h2> <div class="w-50 mx-auto"> <div class="d-flex justify-content-between"><label>Range</label> <div><input type="text" name="values" value="1">%</div> </div> <!--use value=1--> <input type="range" id='fg' class="form-range customRange" value="1" min="1" max="100"> <div class="d-flex justify-content-between"> <span>1</span> <span>100</span> </div> </div> </div> </div>
.customRange { -webkit-appearance: none; width: 100%; height: 25px; background: transparent; outline: none; opacity: 0.7; -webkit-transition: .2s; transition: opacity .2s; } .customRange:hover { opacity: 1; } .customRange::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 25px; height: 25px; background: #04AA6D; cursor: pointer; } .customRange::-moz-range-thumb { width: 25px; height: 25px; background: #04AA6D; cursor: pointer; }
$("input[type=range]").on("change input", function() { $("input[name=values]").val($(this).val()) //assign value.. }) $("input[name=values]").on("change input", function(){ if ($(this).val()==='' || isNaN($(this).val())){ $("input[type=range]").val(0); } else { $("input[type=range]").val($(this).val()); } })

Related: See More


Questions / Comments: