JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" value="default" />
JavaScript
$.fn.defaultValue = function(){
return this.each(function(){
var default_value = $(this).val();
var $this = $(this);
$this.focus( function() {
if ($this.val() == default_value) $(this).val("");
});
$this.blur( function() {
if ($this.val().length == 0){
$this.val(default_value);
}
})
});
};
$('input').defaultValue();