<select id=mysel multiple size=5> <option>One</option> <option>Two</option> <option>Three</option> <option>Four</option> <option>Five</option> <option>Six</option> <option>Seven</option> </select> <script> var arr = $('#mysel').val(); // Nicely jQuery returns an array with an entry for each selected value if (arr == null) arr = []; // If nothing is select, you get null so I set it to an empty array console.log('There are ' + arr.length + ' things selected'); </script>
Programming Tips - jQuery: get all values in a multiple select
Date: 2016dec19
Language: javaScript
Library: jQuery
Q. jQuery: get all values in a multiple select
A. With jQuery its easy but with one caveat.