JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.jquery.com/jquery-1.12.1.min.js"></script>
<input type="Custom" name="donation-amount" class="inpt-first form-control" id="donation-amount" onclick="if(this.defaultValue == this.value) this.value = ''" onblur="if(this.value=='') this.value = this.defaultValue" value="Custom">
JavaScript
var defaultValue = 10;
$(document).ready(function() {
$('#donation-amount').keyup(function() {
// check if numbers are type
var reg = /^\d+$/;
if(reg.test($(this).val())) {
$('#donation-amount').val($(this).val());
} else {
$('#donation-amount').val(defaultValue);
}
});
});