Solved

Display Selected Options in Multiple Select Dropdown

Posted on 2012-04-11
3
360 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now