Alex Alex - 1 year ago 146
jQuery Question

jQuery.val not working on range input?

<input type="range" value="5,17" />

If I try to change the value with
it doesn't change...

But on hidden inputs works:
<input type="hidden" value="s" />

Answer Source

The HTML5 <input type="range" /> does only handle one value between min and max attribute - e.g.:

<input type="range" min="1" max="10" value="5.3" step="0.1" />

$("input[type=range]").val(); // returns 5.3
$("input[type=range]").val(6); // sets value to 6
$("input[type=range]").val(); // returns 6

If you want to have the slide handle a min and a max value in one UI-input you could possibly use jQueryUI's slider:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download