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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:49:21+00:00 2026-05-31T22:49:21+00:00

I have 6 different select boxes and a text field which I need to

  • 0

I have 6 different select boxes and a text field which I need to fetch the value from and combine in to one text field using jQuery.

I understand essentially I will build the value for the targetTextField with a string like this: $('#targetTextField').val(opt1+opt2+opt3+opt4+opt5+opt6+textField);

What do I use to fetch the value of select#options1 and transform that in to opt1?

Would it be along the lines of opt1 = $('select#options1').val(); or am I heading in completely the wrong direction?

I’ve created a basic jsfiddle with just two options at:

http://jsfiddle.net/e2ScF/2/

jQuery

$(function() {
    $("#options").change(function(){
    var opt1 = $('select#options').val()
    }$('#targetTextField').val(opt1+opt2);
});
    $("#options2").change(function(){
    var opt2 = $('select#options2').val()
    }$('#targetTextField').val(opt1+opt2);
});
});​

HTML

<select id="options">
  <option value="" selected>Choose...</option>
  <option value="opt1Value1" >Option 1</option>
  <option value="opt1Value2" >Option 2</option>
</select>
<select id="options2">
  <option value="" selected>Choose...</option>
  <option value="opt2Value1" >Option 1</option>
  <option value="opt2Value2" >Option 2</option>
</select>
<input type="text" id="targetTextField" name="targetTextField" size="31" tabindex="0" maxlength="99">​

…but it doesn’t appear to be working, so I’ve obviously misunderstood or missed something.

  • 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-31T22:49:22+00:00Added an answer on May 31, 2026 at 10:49 pm

    I made this demo for you, hope it helps

    http://jsfiddle.net/e2ScF/5/

    $(function() {
    $("#options").change(function(){
            setTarget() ; // Something has changed so lets rebuild the target
    });
        $("#options2").change(function(){
            setTarget();// Something has changed so lets rebuild the target
    });
    });
    
    // Just get the values you want and update the target
    function setTarget(){
        var tmp = $("#options").val();
        tmp += $("#options2").val();
        $('#targetTextField').val(tmp);
    }
    ​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 4 different select boxes (to select one option from drop down). All
I have different select boxes. I want to select second one with related id.
I have different php output in jQuery-based tabs. This output is formed from database
I have a number of text-boxes which are created dynamically: <?php $columns = $_POST['n_cols'];
I currently have a HTML select box like below. <select name=item_1> <option value=0>Choose one...</option>
I have a need for chained select boxes in my zend framework project: Countries->Regions->Provinces->Towns.
I have four text boxes all with similar code. Each one on hover fades
I have 3 chain select boxes that return three values from the same line
I have a WebForm with 4 combo boxes, which allow user to define different
I have two dependent combo-boxes and the value of second one is populated after

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.