JSFiddle - React, Tailwind, and code Playground
by kachibito
HTML
<input type="text" name="example" id="s" value="search"><input type="submit" value="search" class="btn">
JavaScript
$("#s").focus(function() {
if (this.value == this.defaultValue) {
this.value = "";
}
}).blur(function() {
if (!this.value.length) {
this.value = this.defaultValue;
}
});