Extracting Selected Options from Chosen jQuery plugin as 'val1','val2'

49 Views Asked by At
$(".chosen-select").on('change', function(evt, params) {
    var options = $('#selectID').val();
    var values = options.join();
    console.log(values);
<form action="http://httpbin.org/post" method="post">
        <select id="selectID" multiple class='chosen-select'></select>
</form>

So I'm trying to get the selected options from chosen jquery into a specific format to be used in a query ("NAME IN (" + values + ")";). But in order for me to do that I need the values of my variables to be in the format of 'option1','option2'. But when I do console.log(value): Im getting my output as 'option1, option2'.

0

There are 0 best solutions below