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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:18:28+00:00 2026-06-11T08:18:28+00:00

Hello everyone how can I get two values from different select boxes? I get

  • 0

Hello everyone how can I get two values from different select boxes? I get first value in my select box but I can’t get the second value from another select box.Here is my javascript code:

       <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
      <script type="text/javascript">

 $(document).ready(function () {
              var select = document.forms[0].sel;
              var select2=document.forms[0].sel2;
              select.onchange = function () {
                  var value = select.options[select.selectedIndex].value; // to get Value
               alert(value);

              }
               select2.onchange = function () {
                  var value2 = select2.options[select2.selectedIndex].value; // to get Value
               alert(value2);

              }

          });

        </script>

 <form>
<SELECT NAME="sel" onChange="split(selected value)">
<OPTION VALUE=1>Milk</option>
<OPTION VALUE=2>tea</option>
<OPTION VALUE=3>water</option>
<OPTION VALUE=4>coffee</option>
</SELECT>
</form>

 <form>
<SELECT NAME="sel2" onChange="split(selected value)">
<OPTION VALUE=1>Milk</option>
<OPTION VALUE=2>tea</option>
<OPTION VALUE=3>water</option>
<OPTION VALUE=4>coffee</option>
</SELECT>
</form>
  • 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-11T08:18:30+00:00Added an answer on June 11, 2026 at 8:18 am

    The second select box is in the second form. So:

    var select2 = document.forms[1].sel2;
    

    That said, you can actually use jQuery for these things:

    // bind a change event handler to the second select
    $("select").eq(1).on("change", function() {
      alert( $(this).val() );
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello everyone I have two login but how can I assign these login URLs
hello everyone I'm working with Eclipse under Windows XP, but I can't find there
Hello everyone i have an question about firefox add-on: How i can get the
Hello everyone don't know why this code works on windows but not on linux
Hello everyone I'm currently implementing a simple programming language for learning experience but I'm
Hello everyone I am just learning my first programming language and have just corrected
First of all, Hello everyone(/world) ! I am making an Eclipse RCP app' who
Hello Everyone, I have made so many Flash presentations, but every time i stuck
Hello everyone I have added a search engine on my project but when I
Hello everyone I can't seem to figure out why my emulator isn't working and

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.