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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T14:34:41+00:00 2026-05-17T14:34:41+00:00

Three things: select box 1, input box, select box 2 . Based on the

  • 0

Three things: select box 1, input box, select box 2.
Based on the selections in select box 1 (drop down list 1), I want either input box to be visible or select box 2 to be visible, but not both.

Any help would be great 🙂 I am populating the options in select box 2 based on the choice in select box 1, but sometimes the user’s choice entitles them to enter anything as the input, instead of just choosing from a list of values.

Does anyone know how I can hide/show or add/remove these elements from the page? Would it be more-or-less the same if I had it create a new input box or select box 2 every time the selection changes, and just destroy the last one?

Based on some other questions I notice that I can change the style:none like here
StackOverflow> Replacing a dropdown menu with a text menu
is this the most desirable way to go about this?

I’m still learning the basics of js / DOM so any help (and explanation) would be greatly appreciated!

  • 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-17T14:34:41+00:00Added an answer on May 17, 2026 at 2:34 pm
    <select name='field' id='field' size='1' onchange='checkthis(this);'>
     <option>please select something</option>
     <option value='1'>1</option>
     <option value='2'>2</option>
     <option value='3'>3</option>
     <option value='4'>4</option>
    </select>
    <input type='text' id='text1' name='text1' value='' />
    
    <select name='field2' id='field2' size='1'>
     <option>please select something</option>
     <option value='1'>1</option>
     <option value='2'>2</option>
     <option value='3'>3</option>
     <option value='4'>4</option>
    </select>
    
    <input type='button' id='button' value='Click Me' />
    
    <script language='javascript' type='text/javascript'>
    function checkthis(fld) {
     switch (fld.selectedIndex) {
      case 0:
       document.getElementById("text1").style.display = "none";
       document.getElementById("field2").style.display = "block";
       break;
      case 1:
       document.getElementById("text1").style.display = "block";
       document.getElementById("field2").style.display = "block";
       break;
      case 2:
       document.getElementById("text1").style.display = "block";
       document.getElementById("field2").style.display = "none";
       break;
      case 3:
       document.getElementById("text1").style.display = "none";
       document.getElementById("field2").style.display = "none";
       break;
    
     }
    }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are times when I want to use mootools for certain things and Prototype
I know there are a lot of positive things mod-rewrite accomplishes. But are there
I have tried so many things but I don't understand this sooo confusing. I
Are there any things to be careful about when defining the method_missing method in
I've heard that there are some things one cannot do as a computer programmer,
In the program below, there are two things that I don't understand. How can
There are a few things that I almost always do when I put a
There seem to be a number of weird things one could do if one
Is there an easy way to cache things when using urllib2 that I am
Is there a built in way in SQL Server 2005 to audit things specifically

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.