Advertisement
martawijaya

IMM Contact Form

Apr 30th, 2019
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //open
  2. var links = $('.enable-contact');
  3. var modal = $('.contact-form-wrapper');
  4. var input = $('.contact-form-wrapper').find('.wpcf7-text');
  5.  
  6. input.each(function(){
  7.     $(this).attr("autocomplete", "off");
  8. });
  9.  
  10. links.each(function(){
  11.     $(this).click(function(){
  12.         var option = $(this).parents('.order-lg-first').find('.option').val();
  13.         //add value
  14.         modal.addClass('open');
  15.         modal.find('select').val(option);
  16.         return false;
  17.     });
  18. });
  19.  
  20. //close
  21. var closebtn = $('.close-modal');
  22. closebtn.click(function(){
  23.     modal.removeClass('open');
  24.     setTimeout(function(){
  25.         modal.find('select').val('');
  26.     }, 600);
  27. });
  28.  
  29.  
  30. //input focus
  31. $('.form-group').find('input').focus(function(){
  32.     $(this).parents('.form-group').find('label').addClass('focused');
  33. }).blur(function(){
  34.     if($(this).val() === ''){
  35.         $(this).parents('.form-group').find('label').removeClass('focused');
  36.     }
  37. });
  38. //textarea focus      
  39. $('.form-group').find('textarea').focus(function(){
  40.     $(this).parents('.form-group').find('label').addClass('focused');
  41. }).blur(function(){
  42.     if($(this).val() === ''){
  43.         $(this).parents('.form-group').find('label').removeClass('focused');
  44.     }
  45. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement