1/** 2 * @see http://github.com/NV/placeholder.js 3 */ 4jQuery.fn.textPlaceholder = function () { 5 6 return this.each(function(){ 7 8 var that = this; 9 10 if (that.placeholder && 'placeholder' in document.createElement(that.tagName)) return; 11 12 var placeholder = that.getAttribute('placeholder'); 13 var input = jQuery(that); 14 15 if (that.value === '' || that.value == placeholder) { 16 input.addClass('text-placeholder'); 17 that.value = placeholder; 18 } 19 20 input.focus(function(){ 21 if (input.hasClass('text-placeholder')) { 22 this.value = ''; 23 input.removeClass('text-placeholder') 24 } 25 }); 26 27 input.blur(function(){ 28 if (this.value === '') { 29 input.addClass('text-placeholder'); 30 this.value = placeholder; 31 } else { 32 input.removeClass('text-placeholder'); 33 } 34 }); 35 36 that.form && jQuery(that.form).submit(function(){ 37 if (input.hasClass('text-placeholder')) { 38 that.value = ''; 39 } 40 }); 41 42 }); 43 44};
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.