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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:26:35+00:00 2026-05-13T11:26:35+00:00

Hey, can you help me figure this out? I need to hide/show a div

  • 0

Hey, can you help me figure this out? I need to hide/show a div based on a dropdown box (the dropdown box only has a name, no id). If the value of the dropdown box is 2, it needs to be shown and for anything else it needs to be hidden. Here is what I have so far, but it doesn’t seem to work (I tried using similar code on a checkbox and it worked fine, so obviously i’m missing something). (It’s not possible to modify the dropdown box’s code)

JavaScript

$(document).ready(function() {

$('#addons').hide();

$("input[name='configoption[1]']").change(function() {
        if($(this).val() != 2) {
                $('#addons').hide();
        } else
                $('#addons').show();
        } );
});

});

HTML

<select name="configoption[1]"> 
<option value="1" selected="selected">Test 1</option> 
<option value="2">Test 2</option> 
</select>
<div id="addons">
Hi
</div>    
  • 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-13T11:26:36+00:00Added an answer on May 13, 2026 at 11:26 am

    It seems you just simply specified the wrong element name, input should be select.

    $("select[name='configoption[1]']")
    

    make sure you are getting the element by doing this:

    alert( $("select[name='configoption[1]']").length )
    

    it should be anything other than 0.

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

Sidebar

Related Questions

Hey guys can you help me figure this one out!? I'm still researching for
Hey guys I'm tired and can't figure this one out so any help would
Hey guys, I have this quick bit of code that I can't figure out
Hey all need a lil help sorting a loop for this table out, cant
Hey I'm having trouble trying to figure this one out. UITableView has a method
Hey guys was hoping you can help me out. been at this for like
Hey guys i had an idea yesterday. Can you help me with this. Here
Hey guys can you help me with this. I've got this '/[^A-Za-z]/' but cannot
Hey, I'm trying to get this nav working nicely: http://www.moreheadplanetarium.org/redesign/nav.html I can't figure out
Hey hope someone can help as I am at my wits end with this!?

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.