store selection from multiselect element inside string

I have multiple select box like

<select id="myMultiSelect" class="multiselect form-control" name="Status" multiple="multiple">
<option value="AA">AA option</option>
<option value="BB">BB option</option>
<option value="FF">FF option</option>

How can I usig jquery store selected values inside string separated with comma like

var string = "AA,BB,CC";


You could use the .map() method to get the array of values and then join them:

Example Here

var selectValueString = $('#myMultiSelect > option').map(function () {
  return this.value;
console.log(selectValueString); // "AA,BB,FF"

Alternatively, without jQuery:

Example Here

var options = document.querySelectorAll('#myMultiSelect > option');
var selectValueString =, function(el){
  return el.value;
console.log(selectValueString); // "AA,BB,FF"