Solved

Change CssClass JQuery ASP:Checkbox

Posted on 2014-03-05
4
290 Views
Last Modified: 2014-03-06
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?
0
Comment
Question by:flynny
  • 3
4 Comments
 
LVL 6

Expert Comment

by:M. Jayme Nagy
ID: 39906946
$("input[type='checkbox']").change(function(){
    if($(this).is(":checked")){
        $(this).parent().addClass("COLOR");
    }else{
        $(this).parent().removeClass("COLOR");  
    }
});

CSS
.COLOR{

}
0
 

Author Comment

by:flynny
ID: 39909200
but i need to do it for a particular check box not all.
0
 
LVL 6

Accepted Solution

by:
M. Jayme Nagy earned 500 total points
ID: 39909828
$("#id").click(function() {
    if (this.checked){
       $(this).closest('p').addClass('COLOR');
    } else {
       $(this).closest('p').removeClass('COLOR');
    }
});
0
 
LVL 6

Expert Comment

by:M. Jayme Nagy
ID: 39909869
thanks for the points

good luck on your adventures
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now