[jQuery] adding a class to the label of a checked radio button

[jQuery] adding a class to the label of a checked radio button


I think that this bit of script is adding a class to the for
attribute, but I'm wanting to add the class to the element that has
that for attribute. Can anyone help me do the targeting better?
Thanks
$(document).ready(function() {
    $('div#searchLabels').addClass('active'); // allows me to style the
radio buttons differently when JS is enabled
    $('div#searchLabels :radio[id]').click( function() {
        var selectedInput = $(this).text();
        $('div#searchLabels label').removeClass("selected");
        $('div#searchLabels label.attr("for","' + selectedInput +
'")').addClass("selected");
    });
});