Advertisement
panxop

Untitled

May 28th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Validar campo nombre agregando un label con texto */
  2.  
  3.  function validatename(e)
  4.       {
  5.          var a = '<span class="errorname" style="margin-left:5px;font-family: Georgia;font-size: 20px;" >El nombre posee caracteres no válidos</span>';
  6.          if (!/^[a-zA-ZáéíóúüñÁÉÍÓÚÜÑ ]*$/.test(e.value)) {
  7.             console.log("caracter invalido");
  8.            //e.preventDefault();
  9.            $(e).css("border","1.5px solid #ff000085");
  10.            $('.errorname').remove();
  11.            $(a).insertAfter(e);
  12.          }else{
  13.             $(e).css("border","");
  14.             $('.errorname').remove();
  15.          }
  16.       }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement