JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" id="email" />
<input type="text" id="name" />
CSS
.default {
color: grey;
}
JavaScript
$(function(){
$('#email, #name').addClass('default');
$('#email').focus(focus).blur(blur)[0].defaultValue="example@email.com";
$('#name').focus(focus).blur(blur)[0].defaultValue="Type name here";
});
function focus(){
if (this.value == this.defaultValue) {
this.value = '';
$(this).removeClass('default');
}
}
function blur(){
if (this.value == '') {
this.value = this.defaultValue;
$(this).addClass('default');
}
}