stepho stepho - 1 year ago 97
jQuery Question

Check if HTML input range is a certain value - jquery

I'm trying to dynamically change a page when the the input range is changed to different values? Anyway for jquery to check the value on the fly and allow me to set conditions when the range is moved to a certain value? Thanks

<input type="range" min="0" max="100" name="adjust" id="range"/>

if ( $('input[type="range"]').is().val(50) ) {

alert('Value is 50');


Answer Source

Attach OnChange event handler:

        if ( $(this).val() == "50")
            alert('Value is 50');
<script src=""></script>

<input type="range" min="0" value="25" max="100" name="adjust" id="range"/>

<span id="value"></span>

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