Change CssClass JQuery ASP:Checkbox

Hi all.

I have an ASP:Checkbox which I want to change the color of the text on it.

Now $('#<%=TermsCheckbox.ClientID%>').addClass('myclass');

is adding the class but the checkbox renders the text in a label using the same ID?

Any ideas how i can change this please?
flynnyAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
J NConnect With a Mentor Unicorn wranglerCommented:
$("#id").click(function() {
    if (this.checked){
       $(this).closest('p').addClass('COLOR');
    } else {
       $(this).closest('p').removeClass('COLOR');
    }
});
0
 
J NUnicorn wranglerCommented:
$("input[type='checkbox']").change(function(){
    if($(this).is(":checked")){
        $(this).parent().addClass("COLOR");
    }else{
        $(this).parent().removeClass("COLOR");  
    }
});

CSS
.COLOR{

}
0
 
flynnyAuthor Commented:
but i need to do it for a particular check box not all.
0
 
J NUnicorn wranglerCommented:
thanks for the points

good luck on your adventures
0
All Courses

From novice to tech pro — start learning today.