JSFiddle - React, Tailwind, and code Playground

by GaryC123

HTML

<label id="FirstLabel" for="First"></label>

<input id="First" type="text" maxlength="50" value="" x-autocompletetype="given-name" title="first name" name="First" style="border-width: 1px; border-style: solid; -moz-border-top-colo…rs: none; -moz-border-left-colors: none; border-image: none;"></input>

<script>
    
    validate('First', 'FirstLabel', 'First Name');
    function validate(fieldname, labelname, longname) {
	themessage="";
    longname = typeof longname !== 'undefined' ? longname : fieldname;
	if(document.getElementById(fieldname)) {
        alert("Field exists")
		if(document.getElementById(fieldname).value == "" ) {
			 themessage +=longname+ '\n';
	
    //clearLabelcss(fieldname,"error-redInput error-redSelect" );
    //clearLabelcss(labelname,"error-red" );
    //		_gaq.push(['_trackEvent', 'form errors', 'onsubmit individual', longname,,true]); 
    //		ga('send', 'event', 'form errors', 'onsubmit individual', longname,{'nonInteraction': 1});
	
alert(themessage)				
		}
	}
} 
    </script>