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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:08:00+00:00 2026-05-23T07:08:00+00:00

my requirement is print the multiple selection data in dropdown list. i tried this

  • 0

my requirement is print the multiple selection data in dropdown list. i tried this but it doesn’t work. i dont know where i miss the logic. please correct me. here my code

    function getState() {
                ................
        document.getElementById('statediv').innerHTML=http.responseText;                        
                        http.send(params);

}

within body

    <div>   
        <h1 class="float-left">Create Annual Reports</h1>
        <div class="clear"></div>           
    </div>  
    <form  method="post" target="_blank"   action="<?=base_url();?>reports/prepareannualreport"  onsubmit="return fnValidate();" >
    <div id="registerform"> 
        <p></p> 
        <span class="float-left">State</span>
        <span id="statediv"><select name="multiple" id="multiple" multiple="multiple"><option value="0">(Select)</option></select>
</span>

In the dropdown list data successfully displayed. now when i choose multiple data in dropdown i want to print those values so i used the following function to print.

<script>
    function displayVals() {
      var singleValues = $("#single").val();
      var multipleValues = $("#multiple").val() || [];
      $("p").html(" <b>Multiple:</b> " + 
                  multipleValues.join(", "));
    }

    $("select").change(displayVals);
    displayVals();

</script>

if i replace body content with the following functions it prints the selected data in dropdown.

<select id="multiple" multiple="multiple">
    <option selected="selected">Multiple</option>
    <option>Multiple2</option>
    <option selected="selected">Multiple3</option>
  </select>
  • 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-23T07:08:00+00:00Added an answer on May 23, 2026 at 7:08 am
    $("select").live('click', function(){
        if($("option").is(":selected")) {
            $("p").append("Option Selected"+$(this).val()+"<br />")
        }
    });
    
    <select id="multiple" multiple="multiple">
        <option selected="selected">Multiple</option>
        <option>Multiple2</option>
        <option selected="selected">Multiple3</option>
      </select>
    
    <p></p>
    

    Working Jfiddle @ http://jsfiddle.net/xNmX2/

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

Sidebar

Related Questions

Requirement is this ... We have our 3 web-applications deployed in RHEL-5 server, we
My requirement A table needs to maintain a status column. This column represents one
i am writing a simple c program and my requirement is to print RIP(Instruction
Requirement:- File1 has contents like - ABCD00000001,\some\some1\ABCD00000001,Y,,5 (this indicates there are 5 file in
I have a multiple-selection enabled QListView with an Item delegate (QStyledItemDelegate) I use for
I have a requirement for a set of asp.net MVC websites as follows: Multiple
I currently have a Google map that geocodes multiple markers on the fly but
I have been given a requirement where I need to support multiple databases in
I can imagine system of how can multiple programmers work intensive on same codebase
I'm working chequePrinting project using windows-form, where one of my requirement is to print

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.