SHARE
TWEET

Untitled

a guest Jun 13th, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. jQuery('input[type=text][title],input[type=password][title],textarea[title]').each(function(i){
  2.     jQuery(this).addClass('input-prompt-' + i);
  3.     var promptSpan = jQuery('<span class="input-prompt"/>');
  4.     jQuery(promptSpan).attr('id', 'input-prompt-' + i);    
  5.     jQuery(promptSpan).append(jQuery(this).parent().next().html());
  6.     jQuery(promptSpan).click(function(){
  7.         jQuery(this).hide();
  8.         jQuery('.' + jQuery(this).attr('id')).focus();
  9.     });
  10.     if(jQuery(this).val() != ''){
  11.         jQuery(promptSpan).hide();
  12.     }
  13.     jQuery(this).before(promptSpan);
  14.     jQuery(this).focus(function(){
  15.         jQuery('#input-prompt-' + i).hide();
  16.     });
  17.     jQuery(this).blur(function(){
  18.         if(jQuery(this).val() == ''){
  19.             jQuery('#input-prompt-' + i).show();
  20.         }
  21.     });
  22. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top