Find an input label in jQuery

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') ']');
}

Let’s keep in touch

Get noise-free updates on software, product, and process.

Hey, I'm RJ: digital entomologist and intermittent micropoet, writing from the beautiful Rose City.