I have a user input box where users can type in an amount of USD currency. When the user types in a decimal to represent cents ex. 0.24 the value shows as 0.20 instead of .24 when the input is .244 or .240 it shows as the .24 cents. I would like the user to be able to type in just the .24 cents instead of having to enter in the extra decimal.
var $partialText = $('#partialText');
$partialText.on('keypress', function() {
var $dark = parseFloat($partialText.val()); //Take the input value of partial input as a number
console.log($dark);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input type="number" name="partial" id="partialText" size="15" maxlength="6" />