public
Description: some various js files and examples for me to refer to and use
Clone URL: git://github.com/jnunemaker/javascripts.git
Search Repo:
Modified labelizer to only work with input[type=text] and textarea fields 
as it wouldn't make sense with any other element.
jnunemaker (author)
Wed Jul 02 20:31:14 -0700 2008
commit  0edac49c2c4b5aeb3142045426c5d9572b63637e
tree    88a45c2306bd518a5658ed22fb1d04ca53d5c63f
parent  144f34aa45aa38478b584fa8eaf6c640762c0f08
...
7
8
9
 
 
10
11
12
...
21
22
23
24
 
 
 
25
26
27
...
7
8
9
10
11
12
13
14
...
23
24
25
 
26
27
28
29
30
31
0
@@ -7,6 +7,8 @@
0
  * - On blur, adds the default text and css class back if the user did not fill in the form element.
0
  * - Adds a class to the form element that is removed when user puts information in. This allows
0
  * styling of the label with a lighter color than when the user has "real" text in the form element.
0
+ *
0
+ * NOTE: It only works with input[type=text] and textarea fields. All other elements are ignored.
0
  *
0
  * Usage:
0
  *     $('input').labelize(); // uses blank as the class so you could use style input.blank {color:#ccc;}
0
@@ -21,7 +23,9 @@
0
    */
0
   $.fn.labelize = function(options) {  
0
     return this.each(function() {
0
- new $.labelize(this, options);
0
+ if ((this.tagName.toLowerCase() == 'input' && $(this).attr('type') == 'text') || this.tagName.toLowerCase() == 'textarea') {
0
+ new $.labelize(this, options);
0
+ }
0
     });
0
   };
0
   

Comments

    No one has commented yet.