diff --git a/doc-src/assets/javascripts/placeholder.js b/doc-src/assets/javascripts/placeholder.js index 7081fb74..af978437 100644 --- a/doc-src/assets/javascripts/placeholder.js +++ b/doc-src/assets/javascripts/placeholder.js @@ -1,51 +1,47 @@ (function($) { - + $.fn.replaceholder = function(options) { - + var $placeholder; - + (this.length > 0) ? $this = $(this) : $this = $('input[placeholder]'); return $this.each(function() { - - settings = jQuery.extend({ - focusColor: '#000', - blurColor: '#aaa' - }, options); - + + settings = jQuery.extend(options); + var $placeholder = $(this); - + if ($placeholder.length > 0) { - + var attrPh = $placeholder.attr('placeholder'); - + $placeholder.attr('value', attrPh); - $placeholder.css('color',settings.blurColor) - .bind('focus', function() { - + $placeholder.bind('focus', function() { + var $this = $(this); - + if($this.val() === attrPh) - $this.val('').css('color',settings.focusColor); - + $this.val('').removeClass('placeholder'); + }).bind('blur', function() { - + var $this = $(this); - + if($this.val() === '') - $this.val(attrPh).css('color',settings.blurColor); - + $this.val(attrPh).addClass('placeholder'); + }); - + } - + }); - + }; - + })(jQuery); jQuery(function($){ $(document).ready(function(){ if (!Modernizr.input.placeholder) { $("input[placeholder], textarea[placeholder]").replaceholder() } }) -}) \ No newline at end of file +})