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

  • SEARCH
  • Home
  • 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 8134923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:13:35+00:00 2026-06-06T10:13:35+00:00

Here is my code, I have two checkboxes and want to keep one disabled

  • 0

Here is my code, I have two checkboxes and want to keep one disabled until the other one is enabled:

$(function(){
    $('#remember').live('click', function(event){
        if($('#remember').is(':checked')){
            $('#keepIn').removeAttr('disabled');
        }
        else
            $('#keepIn').attr('disabled', 'disabled');
    });
});

The problem is that this function executes before the default action and when I click in the first one $('#remember').is(':checked') returns false (the old value) instead of true.

  • 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-06-06T10:13:36+00:00Added an answer on June 6, 2026 at 10:13 am

    You can use change event instead:

    $('#remember').live('change', function(event) {
        if (this.checked) {
            $('#keepIn').removeAttr('disabled');
        } else {
            $('#keepIn').attr('disabled', 'disabled');
        }
    });
    

    DEMO: http://jsfiddle.net/jP3NY/


    NB: live method is deprecated. You should better use on or delegate.

    For the newer version of jQuery the solution could be as follows:

    $('body').on('change', '#remember', function(event) {
        $('#keepIn').prop('disabled', !this.checked);
    });
    

    Instead of body you can use any parent element of #remember.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have two dropdown list. first drop down:1 enter code here <form:select path=custName id=custName>
here is what my code looks like i have two forms: class Form_1 extends
What is the issue with this code? Here we have two files: classA.h and
Please see coments in js code. I have two checkboxes <input type=checkbox name=first id=first
I have two tabs one called Sale-Items and the other All-Items and for each
I have two checkboxes in my code as mentioned below: <input type=checkbox id=event_id name=data[Noncompetitor][event_id][]
enter code here I have a table on SQL server 2005 with bigint primary
Here is the code I have to create an UIAlertView with a textbox. UIAlertView
Here's the code I have: var commandsBuffer = List[String]() commandsBuffer ::= cmd.exe commandsBuffer ::=
Here's the code I have: from cStringIO import StringIO from lxml import etree xml

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.