jQuery: Select Multiple Dropdown Items

Back in 2006 I posted a simple piece of Javascript code that would let you select multiple items from a dropdown (or multiselect box) to a textarea. This code has been very popular and people liked it as I can see from different forums being linked to this post.

Here is the same code, but it uses jQuery to do the job. Smaller piece of code than what I’d before. HTML piece remains same and here is the example:


HTML Code:

<form method=POST name='testing'>  
  <select name='testsel' multiple id='testsel'>  
    <option value="one">one</option>
    <option value="two">two</option>
    <option value="three">three</option>  
  <textarea id="txtEditions"></textarea>

jQuery Code:

<script type="text/javascript">
var glue = '+';
try {
	$('#testsel').change(function() {
} catch(e) {

Profession: Web Application Developer Employment: Technical Lead, Interactive Division, GANZ Location: Toronto, Canada

You Might Also Like