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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:54:50+00:00 2026-05-29T22:54:50+00:00

I want to reset childcombo box after disabled by parent combo. Child combo box

  • 0

I want to reset childcombo box after disabled by parent combo. Child combo box is being disabled when i am selecting select option in parent combo box. After populating child combo box if i am selecting select option in parent combo, child combo is going to be disabled but how to reset child combo at this time that is child combo will also show please select option? What i need to add in javascript?

 <script type="text/javascript">
         $(document).ready(function() {
        $(function(){
var arrVal = ["RS", "MN", "KL"];
 $("#parentcombo").change(function(){
 var valToCheck = String($(this).val());

 if ( jQuery.inArray(valToCheck,arrVal) == -1 )
 {
 $("#childcombo").attr("disabled", "true"); 
 }
 else
{ 
         $("#childcombo").removeAttr ( "disabled" );    
}        
});
});
});     
    </script>

HTML

<select id="parentcombo">
<option value="_">select</option>
<option value="RS">RS</option>
<option value="MN">MN</option>
<option value="KL">KL</option>
</select>

<select id="childcombo" disabled="true">
<option value="_">please select</option>
<option value="somevalue">somevalue</option>
<option value="somevalue1">somevalue1</option>
<option value="somevalue2">somevalue2</option>
</select>
  • 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-29T22:54:51+00:00Added an answer on May 29, 2026 at 10:54 pm

    Use $('#childcombo').val("_") to select "please select" option in child combo box.

    If you want to select any option in select element use val() method and pass the option value to it, it will select that option.

    In your case since you want to select "please select" option in child combo box we used its value "_" to pass to val() method.

    Alternative way using pure javascript is to set selectedIndex property of the select element.

    $('#childcombo')[0].selectedIndex = 0;//option index to set selected
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to reset a file upload field when the user selects another option.
How do I reset my numbers after they count? I want something like an
I want to reset the form after calling an ajax function. This is the
I am using jquery-ui tabs ...Actually i want to reset the form fields after
I want to reset a form after setTimeout function call, somehow my syntax is
I want to reset JSF inputs to their original managed bean values after validation
I want to reset a textView height after I have added it to the
I want to reset an object. Can I do it in the following way?
I have multiple input textboxes in my page. I want to reset particular text
I want my application to reset shared preferences when the application reinstalling let's say

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.