Advertisement
Guest User

Untitled

a guest
Dec 15th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $('.form').find('input, textarea').on('keyup blur focus', function(e) {
  2.  
  3.     var $this = $(this),
  4.         label = $this.prev('label');
  5.  
  6.     if (e.type === 'keyup') {
  7.         if ($this.val() === '') {
  8.             label.removeClass('active highlight');
  9.         } else {
  10.             label.addClass('active highlight');
  11.         }
  12.     } else if (e.type === 'blur') {
  13.         if ($this.val() === '') {
  14.             label.removeClass('active highlight');
  15.         } else {
  16.             label.removeClass('highlight');
  17.         }
  18.     } else if (e.type === 'focus') {
  19.  
  20.         if ($this.val() === '') {
  21.             label.removeClass('highlight');
  22.         } else if ($this.val() !== '') {
  23.             label.addClass('highlight');
  24.         }
  25.     }
  26.  
  27. });
  28.  
  29. $('.tab a').on('click', function(e) {
  30.  
  31.     e.preventDefault();
  32.  
  33.     $(this).parent().addClass('active');
  34.     $(this).parent().siblings().removeClass('active');
  35.  
  36.     target = $(this).attr('href');
  37.  
  38.     $('.tab-content > div').not(target).hide();
  39.  
  40.     $(target).fadeIn(600);
  41.  
  42. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement