Is there a way to display dropdown selected options in separate lines? (I have a basket in my form where shows selected movies by users.. but the problem is that if user selects more than one option, they are not shown in separate lines)
For example, with the code below, if I select "Toy story"
and "Forest gump"
, then selectedOpts will be ="Toy storyForest gump"
while I need "Toy story", "Forest gump" in separate lines.
$('#btnRight').on('click', function (e) {
var selectedOpts = $("#movieName option:selected").text();
if (selectedOpts.length == 0) {
alert("NOTHING TO MOVE");
e.preventDefault();
}else {
var obj = {
"movie_name":selectedOpts,
"movie_info": ""
};
alert(selectedOpts);
parent.window.opener.addToBasket(obj);
}
$("#tags").val("");
});
and this is how I see selected movies in the basket: