Solved

Display Selected Options in Multiple Select Dropdown

Posted on 2012-04-11
3
370 Views
Last Modified: 2012-04-11
When a user selects an option from a multiple select dropdown, I'd like beside it or above it to list what has been selected. Alternatively, I'd like to hide it when it is "unselected". Is this possible?

<select name="requestorName" multiple="multiple">
    				
                		<option value="015339">Andrusyszyn, Lawrence</option>
                	
                		<option value="002816">Bailey, Lisa</option>
                	
                		<option value="004723">Baylor, Becke</option>
                	
                		<option value="014398">Brigida, Arthur</option>
                	
                		<option value="013670">Brown, Alicia</option>
                	
                		<option value="014136">Campbell, Christiana</option>
                	
                		<option value="015750">Cannon, Nina</option>
                	
                		<option value="015760">Castonguay, William</option>
                	
                		<option value="003553">Cooper, Donna</option>
                	
                		<option value="015535">Donovan, Brian</option>
                	
                		<option value="009813">Dries, Paul</option>
                	
                		<option value="016827">Echeverria, Patricia</option>
                	
                		<option value="009977">Enichen, Don</option>
                	
                		<option value="004161">Eubanks, Carol</option>
                	
                		<option value="003602">Eubanks, Linda</option>
                	
                		<option value="003090">Faucette, David</option>
                	
                		<option value="018604">Forrester, Tammy</option>
                	
                		<option value="000987">Fuller, Joyce</option>
                	
                		<option value="003196">Gilliland, Lisa</option>
                	
                		<option value="014545">Goldberg, Barbara</option>
                	
                		<option value="019188">Hepler, Eric</option>
                	
                		<option value="016238">Keyes, Ann</option>
                	
                		<option value="009924">Lee, Sarah</option>
                	
                		<option value="010588">Lilje, Jennifer</option>
                	
                		<option value="019495">Morales, Jason</option>
                	
                		<option value="019701">Odom, Jeffrey</option>
                	
                		<option value="019801">Olale, Linda</option>
                	
                		<option value="000943">Parker, Carolyn</option>
                	
                		<option value="016401">Passwaters, Stacey</option>
                	
                		<option value="013250">Perry, Lisa</option>
                	
                		<option value="012366">Ranghel, Susana</option>
                	
                		<option value="004194">Rodrigues, Claire</option>
                	
                		<option value="019640">Sanchez, Diana Perez</option>
                	
                		<option value="014160">Sattar, Abrar</option>
                	
                		<option value="016398">Scott, Jeffrey</option>
                	
                		<option value="015632">Sheets, Robin</option>
                	
                		<option value="019663">Smith, Jackie</option>
                	
                		<option value="010143">Stratton, David</option>
                	
                		<option value="003437">Strowd, Richard</option>
                	
                		<option value="008439">Walker, Nicole</option>
                	
                		<option value="008815">Weinzapfel, Timothy</option>
                	
                		<option value="019019">Williams, Jacquelin</option>
                	
                		<option value="018935">Withers, John</option>
                	
                		<option value="019434">Wooten, Linda</option>
                	
            	</select>
            

Open in new window

0
Comment
Question by:traport
3 Comments
 
LVL 20

Accepted Solution

by:
Proculopsis earned 500 total points
ID: 37832857
Try this jsfiddle.

$("select").change(function() {
    $("#selected").empty();
    $("option:selected", this).each(function() {
        $("#selected").append($("<li/>").text($(this).text()));

    });
});

Open in new window

0
 

Author Closing Comment

by:traport
ID: 37833555
Really cool - I haven't used jfiddle - and this worked beautifully. Thank you!
0
 
LVL 52

Expert Comment

by:_agx_
ID: 37833625
Nice one Proculopsis :)
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question