1/* 2 * jQuery Form Tips 1.2.6 3 * By Manuel Boy (http://www.manuelboy.de) 4 * Copyright (c) 2012 Manuel Boy 5 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php 6*/ 7(function($){ 8 9 $.fn.formtips = function(options) { 10 11 // handle options 12 var settings = $.extend({ 13 tippedClass: "tipped" 14 }, options); 15 16 return this.each(function() { 17 18 // prepare input elements an textareas 19 var e = $(this); 20 21 // do not apply form tips to inputs of type file, radio or checkbox 22 var type = $(e).attr('type'); 23 if(type != 'file' && type != 'checkbox' && type != 'radio') { 24 25 // handle focus event 26 $(e).bind('focus', function() { 27 var lv = $(this).attr('title'); 28 if($(this).val() == lv) { 29 $(this).val('').removeClass(settings.tippedClass); 30 } 31 return true; 32 }); 33 34 // handle blur event 35 $(e).bind('blur', function() { 36 var lv = $(this).attr('title'); 37 if($(this).val() == '') { 38 $(this).val(lv).addClass(settings.tippedClass); 39 } 40 return true; 41 }); 42 43 // handle initial text 44 var lv = $(e).attr('title'); 45 if($(e).val() == '' || $(e).val() == $(this).attr('title')) { 46 $(e).val(lv).addClass(settings.tippedClass); 47 } else { 48 $(e).removeClass(settings.tippedClass); 49 } 50 51 // handle removal of default value 52 $(e).parentsUntil('form').parent().submit(function() { 53 var lv = $(e).attr('title'); 54 if($(e).val() == lv) { 55 $(e).val('').removeClass(settings.tippedClass); 56 } 57 }); 58 59 } 60 61 }); 62 }; 63 64})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.