Arrows do not work on input type = "number"
I used simple html
<input type="number"> It shows a text box with up and down arrows, but the arrows do not work. The value can be increased / decreased by the arrows on the keyboard and mouse scroll, but when I click on any of the arrows, it seems that the down arrow is pressed and the value in the field remains unchanged. Please suggest what to do!
After so many attempts to remove JS CSS n. Understand that the "ember-view" class was creating the problem. I used ember and the div in which I used the input type = "number" had the class "ember-view". Removing this class makes the text field workable :). Thank you Earlier
<div class="ember-view"> <input type="number"> </div> Now
<div> <input type="number"> </div> Well, I am surprised at this, but it seems like an error, at least in Chrome. (Edge doesn't show arrows at all, and I have no other browsers.)
The mousemove event listener (on an element or document) breaks INPUT TYPE = "number" if e.preventDefault () is present:
<input type="number" value="1"/> $(function() { $(document).on('mousemove', function (e) { e.preventDefault(); }); }); See https://jsfiddle.net/MCAU/Lpojfrm2/
Can anyone confirm this?
You can try the following:
HTML
<div id="incdec"> <input type="text" value="0" /> <img src="up_arrow.jpeg" id="up" /> <img src="down_arrow.jpeg" id="down" /> </div> JQuery
$(document).ready(function(){ $("#up").on('click',function(){ $("#incdec input").val(parseInt($("#incdec input").val())+1); }); $("#down").on('click',function(){ $("#incdec input").val(parseInt($("#incdec input").val())-1); }); });