1<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
2<script src="https://cdn.rawgit.com/harvesthq/chosen/gh-pages/chosen.jquery.min.js"></script>
3<link href="https://cdn.rawgit.com/harvesthq/chosen/gh-pages/chosen.min.css" rel="stylesheet"/>
4
5<form action="http://httpbin.org/post" method="post">
6 <select data-placeholder="Begin typing a name to filter..." multiple class="chosen-select" name="test">
7 <option value=""></option>
8 <option>American Black Bear</option>
9 <option>Asiatic Black Bear</option>
10 <option>Brown Bear</option>
11 <option>Giant Panda</option>
12 <option>Sloth Bear</option>
13 <option>Sun Bear</option>
14 <option>Polar Bear</option>
15 <option>Spectacled Bear</option>
16 </select>
17 <input type="submit">
18</form>
1 function getSelectValues(select) {
2 var result = [];
3 var options = select && select.options;
4 var opt;
5
6 for (var i=0, iLen=options.length; i<iLen; i++) {
7 opt = options[i];
8
9 if (opt.selected) {
10 result.push(opt.value || opt.text);
11 }
12 }
13 return result;
14}