JSFiddle - React, Tailwind, and code Playground

HTML

<script type="text/javascript">
function valForm( form ){

    var firstVal, lastVal, emailVal, error = '';
 
    firstVal= form.first.value;  
    lastVal= form.last.value; 
    emailVal= form.email.value; 

    
    if( firstVal.length == 0){
        error += 'First name is required\n';
    }
    
    if( lastVal.length == 0){
         error += 'Last name is required\n';
    }
    
    if( emailVal.length == 0){
         error += 'Email is required\n';
    }
    
    if( error ){
        document.write( "error" )innerHTML = "nope";
        return false;
    }
    
    return true; 
}
</script>
<h2>**Form**</h2>
<form method="post" action="javascript" enctype="text/plain" onsubmit="return valForm(this);">
    <input type=text name="first" id="first" size="20"> First Name<BR>
    <input type=text name="last" id="last" size="20"> Last Name<BR>
    <input type="text" name="email" id="email" size="20"> E-Mail<BR><BR>
    <input type="submit" value="Submit">
    <input type="reset" value="Clear Form"><br>
</form>