I'd like to have an input box that automatically adds a visible percent sign to the user when entering numbers (not just recognizes it as a percent when submitting). Thus, a user hits "2" and sees "2%"
I'm assuming one could use Jquery to do this fairly easily, but I have no idea how! Any ideas?
Thanks everyone.
You can handle the change
event:
$(':input.Percent').change(function() {
$(this).val(function(index, old) { return old.replace(/[^0-9]/g, '') + '%'; });
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With