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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:14:03+00:00 2026-05-30T09:14:03+00:00

I have one combo box which displays a text box when 2nd or 3rd

  • 0

I have one combo box which displays a text box when 2nd or 3rd option is selected, but how to hide that text box when first option is selected?

$("#combo").change(function () {
        $.getJSON('combo.jsp', {
            comboname: this.value
        }, function (data) {
            if(data.isTrue){
            $("#textbox").empty().append("<input type='text' id='text1'/>");// display an empty text box
                   }
                   else{
                       // how to clear that text box and hide it?
                   }
        });
    });

html

<select id="combo" name="comboname">
<option value="_"></option>// how to clear and hide the text box when this option is  
  selected?
<option value="somevalue">somename</option>// when this option is selected then it 
 displays an empty text box
<option value="somevalue1">somename1</option>when this option is selected then it also 
 displays the same empty text box
</select>
// in the following div, text box is being displayed
<div id="textbox">
// here text box is displayed when option 2nd or 3rd is selected from the above combo
</div>

server side (combo.jsp)

JSONObject jsonObj= new JSONObject(); 
 jsonObj.put("isTrue","true");
response.setContentType("application/json");
response.getWriter().write(jsonObj.toString());
  • 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-30T09:14:05+00:00Added an answer on May 30, 2026 at 9:14 am

    Do you really need server side? Here an example without:

    $("#combo").change(function () {
        if (this.value != '_') {  
            $("#textbox").empty().append("<input type='text' id='text1'/>");
        }
        else {
            $("#textbox").hide();
        }
    });
    

    Also see this example.

    But if really need server side, you have to set isTrue conditionally.

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

Sidebar

Related Questions

I have a combo box that I bind to an observable collection, which gets
I have three column in my datagridview .One is text ,one is Combo and
I have a page where my combo box has hundreds of elements which makes
I've read that combo boxes cannot have multiple columns. Which leaves me a bit
I have a dynamic combo box which has the URL as the value. I
Right now I have a calender that only displays one month(what ever month I
Pretty self-explanatory. I want to just have the combo box without any text outside
I have an application that executes a stored procedure. There is a combo box
I have one combobox on the window form and I have one method which
I have one field that I need to sum lets say named items However

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.