JSFiddle - React, Tailwind, and code Playground
HTML
<style type="text/css">
#action > p > span{ color: red; display: none; }
</style>
<script type="text/javascript">
$(document).ready(function(){
$('#action > p > input').blur(function(){
if($(this).val() == '')
$('#leyenda_' + $(this).attr('name')).fadeIn();
else
$('#leyenda_' + $(this).attr('name')).fadeOut();
});
$('#action').submit(function(){
$(this).find('input').blur();
if($(this).find('span:visible').length)
return false;
});
});
</script>
<form action="#" method="post" id="action">
<p><input type="text" name="nombre" /> : Nombre <span id="leyenda_nombre">(El nombre es obligatorio)</span></p>
<p><input type="text" name="mail" /> : Mail <span id="leyenda_mail">(El correo es obligatorio)</span></p>
<p><input type="submit" value="Enviar datos" /></p>
</form>