Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function($) {
- $.fn.focusNotice = function(options) {
- var options = $.extend({ spanClass: 'info', spanText: 'lol', fadeTime: 5000 }, options);
- return this.each(function() {
- $('<span/>').addClass(options.spanClass).text(options.spanText).css({ display: 'none', color: 'red' }).insertAfter(this);
- $(this).bind('focus', function() { $(this).next('span').show().fadeOut(options.fadeTime); });
- });
- }
- })(jQuery)
- jQuery(function($) {
- $('input').focusNotice({ spanText: 'text for this input' });
- $('textarea').focusNotice({ spanText: 'text for this textarea' });
- });
Add Comment
Please, Sign In to add comment