Skip to content

Commit

Permalink
Modified labelizer to only work with input[type=text] and textarea fi…
Browse files Browse the repository at this point in the history
…elds as it wouldn't make sense with any other element.
  • Loading branch information
jnunemaker committed Jul 3, 2008
1 parent 144f34a commit 0edac49
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion jquery.labelize.js
Expand Up @@ -7,6 +7,8 @@
* - On blur, adds the default text and css class back if the user did not fill in the form element.
* - Adds a class to the form element that is removed when user puts information in. This allows
* styling of the label with a lighter color than when the user has "real" text in the form element.
*
* NOTE: It only works with input[type=text] and textarea fields. All other elements are ignored.
*
* Usage:
* $('input').labelize(); // uses blank as the class so you could use style input.blank {color:#ccc;}
Expand All @@ -21,7 +23,9 @@
*/
$.fn.labelize = function(options) {
return this.each(function() {
new $.labelize(this, options);
if ((this.tagName.toLowerCase() == 'input' && $(this).attr('type') == 'text') || this.tagName.toLowerCase() == 'textarea') {
new $.labelize(this, options);
}
});
};

Expand Down

0 comments on commit 0edac49

Please sign in to comment.