add button to clear input code example
Example 1: add clear button to text input
<input type="search" placeholder="Search..."/>
<style>
input[type=search]::-webkit-search-cancel-button {
-webkit-appearance: searchfield-cancel-button;
}
input[type=search] {
-webkit-appearance: none;
}
</style>
Example 2: clear the input when change the radio button
$('input[name="am_payment"]').on('click', function() {
if ($(this).val() === '') {
$('#theamount').val('').prop("removed", true).focus();
}
else {
$('#theamount').val('').prop("disabled", false);
}
});