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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:28:02+00:00 2026-05-27T15:28:02+00:00

I have this html: <select name=garden multiple=multiple id=garden> <option value=1>Flowers</option> <option value=2>Shrubs</option> <option value=6>Trees</option>

  • 0

I have this html:

<select name="garden" multiple="multiple" id="garden">
  <option value="1">Flowers</option>
  <option value="2">Shrubs</option>
  <option value="6">Trees</option>
  <option value="3">Bushes</option>
  <option value="4">Grass</option>
  <option value="5">Dirt</option>
</select>
<select name="po" multiple="multiple" id="po">
  <option value="1">po1</option>
  <option value="2">po2</option>
  <option value="6">po3</option>
  <option value="3">po4</option>
  <option value="4">po5</option>
  <option value="5">po6</option>
</select>
<div></div>

I want to send values of selected options as url parameteres. With this javascript:

$("select").change(function () { 
    var id = $(this).attr('name');
    var str = "";
    $("select option:selected").each(function () {

       str += "&"+id+"="+ $(this).attr('value');             
       });
      $("div").text(str);
    })
    .trigger('change'); 

When the other select box changes, str is replaced with another:
http://jsfiddle.net/eZKUU/

How can I send values to url without replacing?

Thanks in advance

  • 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-27T15:28:02+00:00Added an answer on May 27, 2026 at 3:28 pm

    You have almost correct code. The only one bug is that you are storing changed select name in variable id, and then using it in string creation. This should work correctly:

    $("select").change(function () { 
        var str = "";
        $("select option:selected").each(function () {
            str += '&' + $(this).parent().attr('name') + "="+ $(this).attr('value');   
        });
        $("div").text(str);
    });
    

    And simple optimization is always a good practice 🙂

    $("select").change(function () { 
        var str = "";
        $("select option:selected").each(function () {
            var option = $(this);
            str += '&' + option.attr('name') + "="+ option.attr('value');   
        });
        $("div").text(str);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this html... <select id=View name=View> <option value=1>With issue covers</option> <option value=0>No issue
i have got this HTML code: <select name=audience[8787330733][value]> <option value=></option> <option value=80>Everyone</option> <option selected=1
I have this HTML: <select multiple='multiple' size='3'> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> </select> Using
I have this HTML structure (excerpt): <td> <select id=test1 class=pub_chooser> <option value=99>All Publications</option> <option
I currently have a HTML select box like below. <select name=item_1> <option value=0>Choose one...</option>
Hi I have a html select tag like this: <select name = options> <option
I have some html element like these: <table id=myTable></table> <select name=mySelect> <option value=1>1</option> <option
I have this HTML dropdown: <form> <input type=text id=realtxt onkeyup=searchSel()> <select id=select name=basic-combo size=1>
I have this HTML code for radios: <input type='radio' name='a_27' value='Yes' id='a_27_0' /> <input
I have a form in a .html files where input/select box looks like this

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.