JSFiddle - React, Tailwind, and code Playground

by kazumasa sait

HTML

<form action="">
    
    ご氏名: <input type="text"><br>
    EMAIL:<input type="email" id="email" value="[email protected]"
    </form>

JavaScript

var emailField = document.getElementById('email');

emailField.onfocus = function() {
    if( emailField.value == '[email protected]') {
    emailField.value = '';
    }
}

emailField.onblur = function() {
        if( emailField.value == '') {
    emailField.value = '[email protected]';
    }

}