Carlos Jhon manlulu Carlos Jhon manlulu - 3 months ago 10
Ajax Question

Show the content of Multiple select

i have this code but does not work i just want to put the content of the multiple combobox into textbox name valueholder and every value should be separated by comma. Thanks in advance, i dont know where to start im new in javascript thx

Example output in the textbox should be.


var ValuesArray = $('#countries').val();
var holder = $('#valueholder').val();
ValuesArray== valueholder;
<input type="text" name="valueholder" id="valueholder">
<select id="countries" class="multiselect" multiple="multiple" name="countries[]">

<option value="4800014145089">4800014145089</option>
<option value="4800131590977">4800131590977</option>



It's easy with jquery:

    // get all the option tags
    var options = $('#countries option'); 

    // map the function for each option 
    var values  = $(options).map(function() { 
        return $(this).val(); 


See the working example