Permalink
Browse files

Merge remote-tracking branch 'michaek/master'

Conflicts:
	jquery.overlabel.js
  • Loading branch information...
2 parents 1489672 + 265193a commit e3f07cc2fc8613271e071fbb82057e8db0715ea2 @brandonaaron committed Feb 9, 2013
Showing with 10 additions and 0 deletions.
  1. +4 −0 README.markdown
  2. +6 −0 jquery.overlabel.js
View
@@ -23,6 +23,10 @@ Here is an example of the JS.
// select labels for text inputs, assuming the label is directly before the input
$('form input[type=text]').prev('label').overlabel();
+You can also call this on the inputs directly.
+
+ $('form input:text').overlabel();
+
## License
The overlabel plugin is licensed under the MIT License (LICENSE.txt).
View
@@ -20,6 +20,12 @@
var $label = $(this),
$input = $('#' + $label.attr('for'));
+ // support calling directly on inputs
+ if ($label.is('input')) {
+ $input = $label;
+ $label = $('label[for='+$input.attr('id')+']', this.form);
+ }
+
$label
.addClass('overlabel')
.bind('click', function(event) {

0 comments on commit e3f07cc

Please sign in to comment.