JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" class="input-remover badinput" value="Business Name">
<input type="text" class="input-remover badinput" value="Business Address 1">
<input type="text" class="input-remover badinput" value="Business Address 2">
<input type="text" class="input-remover badinput" value="City">
JavaScript
var textval
$(".input-remover").click(function () {
textval = this.value;
$(this).addClass("currentspot");
if ($(this).hasClass("placeholder")) {
} else {
$(this).val("");
}
});
$("input").keypress(function () {
$(".currentspot").removeClass("badinput");
$(".currentspot").addClass("placeholder");
});
$("input").blur(function () {
if ($(this).hasClass("placeholder")) {
$(".currentspot").removeClass("currentspot");
} else {
$(".currentspot").val(textval);
$(".currentspot").removeClass("currentspot");
}
});