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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:51:37+00:00 2026-06-07T04:51:37+00:00

I need a snippet of code for creating an other dropdown option. Basically, if

  • 0

I need a snippet of code for creating an “other” dropdown option. Basically, if there are 3 options for color: red|green|blue, I want them to have the ability to select other and when selected a div appears with a textbox for them to enter the next color. Posting code now….sorry people. Here is what I have tried so far:

<label class="desc">
                                    Operating System:
                                </label>
                                <div><select name="os" id="os"><option value="1" selected = "selected">Windows 98</option>

Windows ME
Create New

<script type="text/javascript">
$(document).ready(function(){
  $('#os').change(function(){
    if($(this).val() == 'other')
      $('#otheros').show();
    else
      $('#otheros').hide();
  });
});
</script>
  • 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-07T04:51:40+00:00Added an answer on June 7, 2026 at 4:51 am

    here is a code snippet and here is the demo

    #otherOption
    {
        display:none;
        margin-left:5px;
    }
    
    <select id='ddlColors'>
        <option value = 'red'>red</option>
        <option value = 'blue'>blue</option>
        <option value = 'other'>other</option>
    </select>
    <div id='otherOption'>
        <input type='text' />
    </div>
    
        $(document).ready(function(){
        $('#ddlColors').change(function(){
            if($(this).val() == 'other')
                $('#otherOption').show();
            else
                $('#otherOption').hide();
        });
    });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need the java code snippet for the below logic: Following is a string
I need to run a PHP code snippet in a Drupal template and prevent
I know that I need to add the tracking code snippet at the bottom
In the code snippet below, from my jQuery setup, I need to check if
I have a fileA with a snippet of code, and I need a script
I need to isolate user-written code snippets from each other in javascript. For now
I need a code snippet for converting amount of time given by number of
Here is the code snippet: http://jsbin.com/ekupa3/2/edit I need to return the table rows (tr)
I'm looking for a function or code snippet or some starting help in creating
I have a ModelAdmin where I need to insert some html-snippet that is not

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.