jquery.placeholder: Fixup for a8145d6fa2
[lhc/web/wiklou.git] / resources / jquery / jquery.placeholder.js
index 7badb11..f7c9ae0 100644 (file)
  */
 ( function ( $ ) {
 
-       $.fn.placeholder = function () {
+       $.fn.placeholder = function ( text ) {
 
                return this.each( function () {
                        var placeholder, $input;
 
+                       if ( arguments.length ) {
+                               this.setAttribute( 'placeholder', text );
+                       }
+
                        // If the HTML5 placeholder attribute is supported, use it
                        if ( this.placeholder && 'placeholder' in document.createElement( this.tagName ) ) {
                                return;
                        }
 
-                       placeholder = this.getAttribute( 'placeholder' );
+                       placeholder = arguments.length ? text : this.getAttribute( 'placeholder' );
                        $input = $(this);
 
                        // Show initially, if empty