I have an HTML5 'range' control to which I want to add a plus (+) and minus (-) buttons on either sides.
The fiddle works fine, except that the value increase (or decrease) only once on 'click and hold'. While I want is it should increase (or decrease) continuously.
Fiddle
HTML,
<input type='button' id='minus'/>
<div class='range-container'>
<input id='range' type='range' min='0' max='100' step='1'/>
</div>
<input type='button' id='plus'/>
JavaScript,
$('#plus').click(function() {
$('#range').val(parseInt($('#range').val()) + 1);
});
$('#minus').click(function() {
$('#range').val(parseInt($('#range').val()) - 1);
});
HTML5 'number' control have this experience natively.
Looked through SO, couldn't find this question anywhere. Closest I got is, this, which again does only one click.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…