Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5928591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:18:35+00:00 2026-05-22T14:18:35+00:00

<label><input type=checkbox name= /> Normal</label> <label><input type=checkbox name= checked=checked /> Checked</label> <label><input type=checkbox name=

  • 0
<label><input type="checkbox" name="" /> Normal</label>
<label><input type="checkbox" name="" checked="checked" /> Checked</label>
<label><input type="checkbox" name="" disabled="disabled" /> Disabled</label>

If the checkbox is ‘checked’, its label should have class ‘checked’, same for ‘disabled’.

I tried this, but doesn’t seem to work:

$("input[type=checkbox][checked]").each( 
    function() { 
       $(this).parent().addClass('checked');
    } 
);

http://jsfiddle.net/eJfT6/

Thanks for your help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T14:18:36+00:00Added an answer on May 22, 2026 at 2:18 pm

    You can test this:

    $('input:checkbox').each(function(){
    
        if($(this).is(':checked')){
    
            $(this).parent().addClass('checked');
        }
    
        if($(this).is(':disabled')){
    
            $(this).parent().addClass('disabled');
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose to have a code like this: <div class=notSelected> <label>Name <input type=text name=name id=name
I have an Element Like <div class=control> <label>&nbsp;</label> <input type=checkbox id=1><span class=controlText>Check Box</span> <div
For this HTML <label id=nameWrapper><input type=checkbox name=name />guest</label> What's the shortest javascript code to
Can somebody help me with this. There is HTML code: <h3> <label> <input type=checkbox
I'm searching for a jQuery plugin that does this. for example: <label><input type=checkbox depends_on=foo=5
I have a form.html: <div id=tag_option> <li><label for=id_customer_type>Customer type:</label> <select id=id_customer_type class=required name=customer_type> <option
i want insert this form value to datanase : <input type=checkbox name=brand1 id=brand1 value=1>
I always try to do the following: <label><input type=checkbox /> Some text</label> or <label
I'm using Zend_Form to output a set group of checkboxes: <label style=white-space: nowrap;><input type=checkbox
i want to output some text in an label <input type=text size=20 maxlength=20 name=pizza1

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.