JSFiddle - React, Tailwind, and code Playground
by Sunny Sharma
HTML
<form name="" id="" method="">
<fieldset>
<legend><strong>My Form</strong></legend>
<div class="">
<label for="name">Name:-</label>
<input type="text" value="" id="name" />
</div>
<div class="">
<label for="email">Email:-</label>
<input type="text" value="your email" id="email" />
</div>
<div class="">
<label for="companyId">Company Name:-</label>
<input type="text" value="" id="companyId" />
</div>
</fieldset>
</form>
JavaScript
var emailField = document.getElementById("email");
emailField.onfocus = function(){
if(emailField.value == "your email"){
emailField.value ="";
}
};
emailField.onblur = function(){
if(emailField.value ==""){
emailField.value = "your email";
}
};