jquery get label text associated with checkbox

Sam Deering
Share

Simple jQuery code snippet to get label text associated with checkbox.

console.log($('label[for="carHireChk"]').html());
$("label[for='comedyclubs']")
$("label[for=' + this.attr("id") + ']").attr('class', 'error');

See doco for more info: http://api.jquery.com/next-adjacent-Selector/