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 8069113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:54:53+00:00 2026-06-05T12:54:53+00:00

I want to disable by default the inputs, and i have a check box

  • 0

I want to disable by default the inputs, and i have a check box that allows to enable them;
so my code of the checkbox is :

function toggleStatus() {
  if ($('#toggleElement').is(':checked')) {
    $('#elementsToOperateOn :input').attr('disabled', true);
  } 
  else {
    $('#elementsToOperateOn :input').removeAttr('disabled');
  }
}

and it’s called in an input with onchange="toggleStatus()"; but the default status of the inputs are enabled and i don’t want to add disabled=”disabled” to each input, how can i do it with jquery? and how can i make it work with the existing onchange?

  • 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-05T12:54:55+00:00Added an answer on June 5, 2026 at 12:54 pm
    $(function(){
        $('#elementsToOperateOn :input').prop('disabled', true);
    });
    

    Disable the inputs when the DOM is ready.

    O.K. After your update, the answer is even simpler, just trigger the onchange event:

    Either with:

    toggleStatus();
    

    or with

    $('#toggleElement').change();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to disable an input Box AND a button when a checkbox is
I want to disable all Foreign key constraints and re-enable them after, is there
I want to disable or override the default help function of browsers. I tried
I want to disable the option that allows users to select the different name
I have a CMS that multiple people administer. We enable/disable some of our shipping
MSDTC is disabled by default (windows 2003 - onwards) and I want to have
I want to disable click on a certain <div> so that when you select
I want to disable the default contextMenu when a user right-clicks on an input
I want to disable inlining for a particular function. What the compiler does for
I have a simple form with some radio buttons. I want to disable some

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.