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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:12:33+00:00 2026-06-17T23:12:33+00:00

Alright so I’m trying to remove a class based on a dropdown menu’s selectedIndex,

  • 0

Alright so I’m trying to remove a class based on a dropdown menu’s selectedIndex, specifically, I want the div with the id=hide to appear when someone selects the second option in my dropdown menu (selectedIndex of 1), and disappear again if they select a different option.

Here is my html code:

<div id="product-variants">      
                <select id="product-select" name="id">

                        <option value="269270508">No Charm</option>

                        <option value="269270608">Heart (Add $25)</option>

                        <option value="269270614">Horseshoe Bead (Add $25)</option>

                        <option value="269270666">Crystal Horseshoe (Add $25)</option>

                        <option value="269270692">Cowgirl Cross (Add $25)</option>

                        <option value="269270732">Lucky Charm (Add $35)</option>

                        <option value="270460652">Round (Add $25)</option>

                        <option value="269270562">Small Star (Add $20)</option>

                        <option value="269270598">Large Star (Add $25)</option>
    </select>
</div>

<div id="hide" class="hidden"><form>
<input id="checkbox" type="checkbox" name="vehicle" value="Bike">Engraving?<br>
</form>
    <form>
Engraving Message: <input type="text" name="engraving"><br>
        </form></div>

My script:

var choice = getElementById("product-select").selectedIndex;

if (choice == 1){

    $('#checkbox').change(function(){
        $('#hide').removeClass('hidden');
    });

}

And CSS:

.hidden {
    display:none
}

And a link to it on jfiddle: http://jsfiddle.net/AFrjz/2/

I’ve been trying to figure this out for hours and just can’t seem to do it.

Thanks so much!

  • 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-17T23:12:34+00:00Added an answer on June 17, 2026 at 11:12 pm

    try this

    if (choice == 1){
    
      //$('#checkbox').change(function(){ you are callinjg a change event here... so the hide is not fired..
        $('#hide').removeClass('hidden');
     // });
    
    }
    

    UPDATED

    I want the div with the id=hide to appear when someone selects the second option in my dropdown menu (selectedIndex of 1), and disappear again if they select a different option.

    i used the change event of the selectbox.. and checked the selected value.. if value is your second options’s value.. then remove class else addclass

    $("#product-select").change(function(){
     var choice = $(this).val()
    
     if (choice == '269270608'){
    
    //$('#checkbox').change(function(){
        $('#hide').removeClass('hidden');  //remove class here
    //});
    
     }else{
        $('#hide').removeClass().addClass('hidden');  //else addclass
     }
    
    });
    

    fiddle here

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

Sidebar

Related Questions

Alright, here I am again trying to write code from scratch and I can't
Alright, right now I am trying to create a basic four in a row
Alright I know my error and what it means. But, could someone show me
Alright, I have a fairly simple design. class Update(models.Model): pub_date = models.DateField() title =
Alright so I am making a commandline based implementation of a website search feature.
Alright, so I've done a bit of searching and trying with no luck. I'm
Alright Gents, Im trying to search a vb.net combo box for an item. The
Alright, what I'm trying to do is: setting an imageview to be on the
Alright, so I am currently trying to find all strings in a list that
Alright, so I have two models Teacher and Account: public class Teacher : Person

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.