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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T12:23:43+00:00 2026-05-29T12:23:43+00:00

Please be easy with me, I am trying to solve but could not hence

  • 0

Please be easy with me, I am trying to solve but could not hence asking for help. I have 2 combo boxes named as first combo box and second combo box in auto.jsp.

I am getting value in a div in auto.jsp by onchange event of first combo box, but the value, i am getting is not populating in the second combo box rather it is being displayed like plain text inside the id combo2. How to populate this data with in that second combo box. I tried a lot but could not do it , any ideas please?

auto.jsp

<script type="text/javascript">
    $(document).ready(function() {
        $("#combo1").change(function() {
            $.get('combo.jsp', { combo1Val : $(this).val() }, function(responseData) {
                $("#combo2").replaceWith(responseData);
            });
        });
    });          
</script>

<body>
    <select id="combo1" name="combo1Val">// After onchange event of this combo box, second box is disappeared and i am getting value 1, how can i display this one inside the option value of second combo box?
        <option value="">select</option>
        <option value="1">One</option>//
    </select>

    <select id="combo2" name="combo2">
        <option value="">select</option>
        <option value="2">Two</option>
    </select>
</body>

combo.jsp

<% 
    String combo1Val=request.getParameter("comboVal");
    out.println(combo1Val);// displaying value 1 in auto.jsp in id combo2
%>

Any ideas please?

  • 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-29T12:23:44+00:00Added an answer on May 29, 2026 at 12:23 pm

    Try replacing this line:

    $("#combo2").replaceWith(responseData);
    

    With something like this:

    $("#combo2").append(
       $("<option></option>").html(responseData).val(responseData)
    );
    

    That should add a new option to the end of the second combo, where both the display text and the value attribute will be set to responseData (since you’re not returning separate values for those).

    http://www.htmlgoodies.com/primers/jsp/

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

Sidebar

Related Questions

I'm trying to parse some html with PhpQuery, but it is not easy for
I think I have a pretty easy problem to solve, but I have been
Could someone please recommend a simple (as in very easy to understand) charting library
I need some with help with PowerShell, please. It should be pretty easy: I
I'm little confused with Cactus and mock objects (jMock, Easy mock). Could anyone please
Please help! I need to produce a Crystal Report with multiple data columns, but
Please take it easy on me. I'm a newbie and is trying to learn
I am a beginner so please take it easy. First some history, I am
I'm new to postgres, so please take it easy on me. I'm trying to
I'm a noob so please forgive if this is an easy question but I'm

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.