Guest User

Untitled

a guest
Jan 14th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. var showError = function(ctx, msgKey) {
  2. var errorContainer = document.createElement("p");
  3. errorContainer.setAttribute("class", "error");
  4.  
  5. //First remove any error messages so we do not duplicate
  6. ctx.next(".error").remove();
  7. $(errorContainer).append(i18n.msgStore[msgKey]).insertAfter(ctx);
  8. };
  9.  
  10. $("#email").blur(function(event) {
  11.  
  12. var emailErr = $(this).next(".error");
  13.  
  14. if($.trim($(this).val()) === "") {
  15. showError($(this), "emailInvalid");
  16. } else if(emailErr) {
  17. emailErr.remove();
  18. }
  19. });
Add Comment
Please, Sign In to add comment