user2828251 user2828251 - 3 months ago 13
HTML Question

HTML input range can't get current value

I'm using jQuery for getting the current range value.
for some reason I only manage to get the default value and not the user selection.

this id the HTML:

<input id="hotel-range-min" type="range" min="0" max="200" value="20" />


and this is how I'm trying to get the current value:

alert($("#hotel-range-min").attr('value'));


no matter if the user changes the value, the alert is always 20 and it's need to be the current value.

I've added a JSfiddle (I'm trying to get the minimum value from the range field, now it's by alert when button click):

http://jsfiddle.net/natalipolishuk/fsKh8/2/

Answer

Try

alert($("#hotel-range-min").val());

Cheers

Comments