JavaScript - - By Sam Deering

jquery get label text associated with checkbox

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/

Sponsors
Login or Create Account to Comment
Login Create Account