I'm interested in sticking with some basic HTML elements to let users increment the value in a number input field.
I know this is possible through Javascript/JQuery rewiring, but is it possible to interact with these arrows without JS?
Thanks!
I'm interested in sticking with some basic HTML elements to let users increment the value in a number input field.
I know this is possible through Javascript/JQuery rewiring, but is it possible to interact with these arrows without JS?
Thanks!
Yes, you can (webkit only I assume):
<style>
input[type=number] {
height: 30px;
line-height: 30px;
font-size: 16px;
padding: 0 8px;
}
input[type=number]::-webkit-inner-spin-button {
-webkit-appearance: none;
cursor:pointer;
display:block;
width:8px;
color: #333;
text-align:center;
position:relative;
}
input[type=number]:hover::-webkit-inner-spin-button {
background: #eee url('http://i.stack.imgur.com/YYySO.png') no-repeat 50% 50%;
width: 14px;
height: 14px;
padding: 4px;
position: relative;
right: 4px;
border-radius: 28px;
}
</style>
<input type="number" value="0">
See JSFiddle method 1
See JSFiddle method 2
Reference