I am trying to change the standard Ruby on Rails form to let the user input a value with HTML5 range. I can't figure out how I should replace the standard "<%= f.text_field :W1 %>".
I have a slider :
<input class="slide" type="range" min="0" max="200" id="slider1">
Displaying value in :
<text id="W1">100</text>
Thanks to Ajax :
$("#slider1").change(function () {
var newValue = $('#slider1').val();
$("#W1").html(newValue);
});
I can't find out where and how I should get the input value to set W1 ?
EDIT : HTML5 range is range_field form herlper in Ruby. I'm still searching for the right implementation of it so any help would be appreciated
I have it ! I had to replace
<input class="slide" type="range" min="0" max="200" id="slider1">
by
<%= f.range_field :w1, :min=>0, :max=>200, :class=>"slide", :id=>"slider1"%>
Thanks to those who helped me !
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With