HTML input range slider call function when stop sliding -
i have slider implemented in html:
<input type="range" onchange="app.setspeed()" name="slider1" id="slider1" value="0" min="0" max="255" />
it incrementally calls function app.setspeed()
. how can call function @ release of slider? saw there should exist on-handle-up, not work in html version.
it's possible jquery .click()
or .change()
functions:
$('#range').change(function() { $('div').html( $(this).val() ); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input type="range" id="range"> <div></div>
fiddle
you can pure **javascript*:
function addevent(el, name, func, bool) { if (el.addeventlistener) el.addeventlistener(name, func, bool); else if (el.attachevent) el.attachevent('on' + name, dunc); else el['on' + name] = func; } addevent(range, 'change', function(e) { mytext.innerhtml = e.target.value; }, false);
<input type="range" id="range"> <div id="mytext"></div>
fiddle
hope helped.
Comments
Post a Comment