JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" value="Lorem" />
<textarea>Lorem ipsum</textarea>

JavaScript

$("input[type=text], textarea").each(function() {
    var storedValue = $(this).attr("value");
    $(this).data("value", {
        datavalue: storedValue
    });
    $(this).focus(function() {
        if ($(this).val() == storedValue) {
            $(this).val('');
        }
    });
    $(this).blur(function() {
        var restoredValue = $(this).data("value").datavalue;
        if ($(this).val() == '') {
            $(this).val(restoredValue);
        }
    });
});