Guest User

Untitled

a guest
Apr 22nd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. (function($) {
  2. $.fn.focusNotice = function(options) {
  3. var options = $.extend({ spanClass: 'info', spanText: 'lol', fadeTime: 5000 }, options);
  4. return this.each(function() {
  5. $('<span/>').addClass(options.spanClass).text(options.spanText).css({ display: 'none', color: 'red' }).insertAfter(this);
  6. $(this).bind('focus', function() { $(this).next('span').show().fadeOut(options.fadeTime); });
  7. });
  8. }
  9. })(jQuery)
  10.  
  11. jQuery(function($) {
  12. $('input').focusNotice({ spanText: 'text for this input' });
  13. $('textarea').focusNotice({ spanText: 'text for this textarea' });
  14. });
Add Comment
Please, Sign In to add comment