In the code shown below, how to get the values of multiselect box in function val() using jQuery or pure JavaScript?
val()
var data=[]; var $el=$("#my-select"); $el.find('option:selected').each(function(){ data.push({value:$(this).val(),text:$(this).text()}); }); console.log(data)