How can I make an input element accept numbers only in multiples of 50?
I know we can specify step="50" as an attribute, but I would prefer a solution that is triggered by the keyup event.
I found this code, which prevents users from entering a number less than 50.
Question : How can I adjust this code so that only multiples of 50 can be entered ?
$('#numberbox').keyup(function(){
if ($(this).val() < 50){
alert("Minimum Quantity: 50");
$(this).val('50');
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input id="numberbox" type='number'>