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

  • Home
  • SEARCH
  • 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 7744711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:49:58+00:00 2026-06-01T09:49:58+00:00

Hi I have a code example available here: http://jsbin.com/oxoweh My problem is that I

  • 0

Hi I have a code example available here: http://jsbin.com/oxoweh

My problem is that I cannot get the value that is being entered into the textbox so that when the select button is clicked the second dropdown will display only the data related to what was entered into the text box. for example if fruits is entered into the textbox I want to have the subcat dropdown have all fruits in it instead of using the existing category dropdown menu

  • 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-01T09:50:00+00:00Added an answer on June 1, 2026 at 9:50 am

    http://jsfiddle.net/goldentoa11/P3hs8/1/

    I added a parameter to your “SelectSubCat()” called txtValue. This is so you can pass the value you want to compare against.

    You’ll need to call the “SelectSubCat()” function with the text field’s value when you call it. I added an id to the text field called “selectText”, and when I click the button I had added

    onclick="SelectSubCat(document.getElementById('selectText').value)"
    

    and this will call the function with the text of the input. Then instead of using the value from the form, it uses the value passed to it, and creates the appropriate sub category. Lastly, you need to change the Category’s “onchange” function to just pass an empty string.

    function SelectSubCat(txtValue) {
    
    if(txtValue == "") txtValue = document.drop_list.Category.value;
    // This line is to set txtValue to Category's value if the current value is blank. 
    // In other words, if it was called by changing the dropdown, 
    // give it the drop down's value.
    
    // ON selection of category this function will work
    removeAllOptions(document.drop_list.SubCat);
    addOption(document.drop_list.SubCat, "", "SubCat", "");
    
    if (txtValue == 'Fruits') {
        addOption(document.drop_list.SubCat, "Mango", "Mango");
        addOption(document.drop_list.SubCat, "Banana", "Banana");
        addOption(document.drop_list.SubCat, "Orange", "Orange");
    }
    if (txtValue == 'Games') {
        addOption(document.drop_list.SubCat, "Cricket", "Cricket");
        addOption(document.drop_list.SubCat, "Football", "Football");
        addOption(document.drop_list.SubCat, "Polo", "Polo", "");
    }
    if (txtValue == 'Scripts') {
        addOption(document.drop_list.SubCat, "PHP", "PHP");
        addOption(document.drop_list.SubCat, "ASP", "ASP");
        addOption(document.drop_list.SubCat, "Perl", "Perl");
    }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose we have this example: http://techdroid.kbeanie.com/2009/07/custom-listview-for-android.html with source code available here: http://code.google.com/p/myandroidwidgets/source/browse/trunk/Phonebook/src/com/abeanie/ How can
I have this code (an example that PHP generates for me)... <select id=outsideBlue3> <option
Anyone have example Rx code that shows how to execute an action due to
I have some code that I absolutely must implement using goto . For example,
I have a problem. I wrote example code and I want to build it
I'm building an web app that uses this code to search for addresses: http://code.google.com/intl/en/apis/maps/documentation/javascript/examples/places-autocomplete.html
I have the following code (available for a test run here ): <div style=margin:10px>
my JavaDoc doesn't work when I have a code example with an annotation. Any
So I have some openGL code (such code for example) /* FUNCTION: YCamera ::
Can I have good example or code about how to use Ajax Datepicker in

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.