Find an input label in jQuery
- 5/4/2011
- ·
- #index
Find the label wrapping a user-input control
$.fn.findLabel = function() {
var tags = {'input':1,'textarea':1,'select':1};
if($(this).get(0).tagName.toLowerCase() in tags)
return $('label[for=' $(this).attr('id') ']');
}```