1jQuery.fn.hint = function (blurClass) { 2 if (!blurClass) { 3 blurClass = 'blur'; 4 } 5 6 return this.each(function () { 7 // get jQuery version of 'this' 8 var $input = jQuery(this), 9 10 // capture the rest of the variable to allow for reuse 11 title = $input.attr('title'), 12 $form = jQuery(this.form), 13 $win = jQuery(window); 14 15 function remove() { 16 if ($input.val() === title && $input.hasClass(blurClass)) { 17 $input.val('').removeClass(blurClass); 18 } 19 } 20 21 // only apply logic if the element has the attribute 22 if (title) { 23 // on blur, set value to title attr if text is blank 24 $input.blur(function () { 25 if (this.value === '') { 26 $input.val(title).addClass(blurClass); 27 } 28 }).focus(remove).blur(); // now change all inputs to title 29 30 // clear the pre-defined text when form is submitted 31 $form.submit(remove); 32 $win.unload(remove); // handles Firefox's autocomplete 33 } 34 }); 35};
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.