1/* 2 * jQuery Form Tips 1.2.5 3 * By Manuel Boy (http://www.manuelboy.de) 4 * Copyright (c) 2011 Manuel Boy 5 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php 6*/ 7 8jQuery.noConflict(); 9var $form = jQuery; 10 11 12$form(document).ready(function() { 13 14 $form('form input.help, form textarea.help').formtips({ 15 tippedClass: 'tipped' 16 }); 17 18}); 19 20 21 22(function($form){ 23 24 $form.fn.formtips = function(options) { 25 26 // handle options 27 var settings = jQuery.extend({ 28 tippedClass: "tipped" 29 }, options); 30 31 return this.each(function() { 32 33 // prepare input elements an textareas 34 var e = $form(this); 35 36 // do not apply form tips to inputs of type file, radio or checkbox 37 var type = $form(e).attr('type'); 38 if(type != 'file' && type != 'checkbox' && type != 'radio') { 39 40 // handle focus event 41 $form(e).bind('focus', function() { 42 var lv = $form(this).attr('title'); 43 if($form(this).val() == lv) { 44 $form(this).val('').removeClass(settings.tippedClass); 45 } 46 return true; 47 }); 48 49 // handle blur event 50 $form(e).bind('blur', function() { 51 var lv = $form(this).attr('title'); 52 if($form(this).val() == '') { 53 $form(this).val(lv).addClass(settings.tippedClass); 54 } 55 return true; 56 }); 57 58 // handle initial text 59 var lv = $form(e).attr('title'); 60 if($form(e).val() == '' || $form(e).val() == $form(this).attr('title')) { 61 $form(e).val(lv).addClass(settings.tippedClass); 62 } else { 63 $form(e).removeClass(settings.tippedClass); 64 } 65 66 // handle removal of default value 67 $form(e).parentsUntil('form').parent().submit(function() { 68 var lv = $form(e).attr('title'); 69 if($form(e).val() == lv) { 70 $form(e).val('').removeClass(settings.tippedClass); 71 } 72 }); 73 74 } 75 76 }); 77 }; 78 79})(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.