JSFiddle - React, Tailwind, and code Playground

by jakie8

HTML

<input type="text" value="Default Val" class="clearit">

JavaScript

$('.clearit').focus(function() {
    fieldValue = $(this).val();
    $(this).val('');
});
$('.clearit').focusout(function() {
    if ($(this).val().length < 1) {
        $(this).val(fieldValue);
    }
});