Here is code for removing the input type number spinners or arrows and disable scrolling value using javascript and css
<script>
$(document).ready(function () {
// disable mousewheel on a input number field when in focus
// (to prevent Cromium browsers change the value when scrolling)
$('form').on('focus', 'input[type=number]', function (e) {
$(this).on('mousewheel.disableScroll', function (e) {
e.preventDefault()
});
});
$('form').on('blur', 'input[type=number]', function (e) {
$(this).off('mousewheel.disableScroll')
});
});
</script>
<style>
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
margin: 0;
}
//For Firefox
input[type=number] {
-moz-appearance:textfield;
}
</style>
Input Field with with number as attribute value
<input type="number"/>
Demo
Input Field with with number as attribute value
<script>
$(document).ready(function () {
// disable mousewheel on a input number field when in focus
// (to prevent Cromium browsers change the value when scrolling)
$('form').on('focus', 'input[type=number]', function (e) {
$(this).on('mousewheel.disableScroll', function (e) {
e.preventDefault()
});
});
$('form').on('blur', 'input[type=number]', function (e) {
$(this).off('mousewheel.disableScroll')
});
});
</script>
<style>
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
margin: 0;
}
//For Firefox
input[type=number] {
-moz-appearance:textfield;
}
</style>
Input Field with with number as attribute value
<input type="number"/>
Demo
Input Field with with number as attribute value
0 comments:
Post a Comment