Question: I have a multiple select option that display the result in a div container, when click on ctrl+"orange""apple""banana" the result display: "orange, apple, banana" in one line, but i want to display each result in a new single line with a link that goes to different page like this:

Orange - "goes to a link"   

Apple - "goes to a link"   

Banana - "goes to a link"   

Here are my codes below:

```
<script src="jquery-mobile/jquery-1.8.3.min.js" type="text/javascript">

</script>
<select name="" multiple="multiple" id="select-custom-19">    
    <option>Add Fruits</option>        
    <option value="orange" selected>orange</option> 
    <option value="apple">apple</option>
    <option value="banana">banana</option>             </select>
<div style="width:300px; height:70px; background-color:#E1D903; 
        color:#000000; margin: 10px; "> <span id="yourfruit"> </span>

</div>
<script type="text/javascript">
    $(document).ready(function() {

        $('#select-custom-19').change(function() {
            /* setting currently changed option value to option variable */
            var option = $(this).find('option:selected').val();
            /* setting input box value to selected option value */
            $('#yourfruit').text($(this).val());
        });
    });
</script>

```

your help will be highly appreciated.

Thanks

Answer: 
You can iterate throug items and display them, append an anchor (`<a />`) and use `<br />` for a new line. 

Make sure to add `.empty()` to clean the fruits from list before `.append()` other items to `$('#yourfruit')`, like in example below.

```
var fruits = $(this).val();
$('#yourfruit').empty();
for (var fruit in fruits) {
   var label = $('<label/> ').text(fruits[fruit]+" - ");
   $('#yourfruit').append(label)
                   .append($('<a  class="tab-btn" />').text(fruits[fruit]).attr('href', fruits[fruit] + '.html'))
                  .append('<br />');
}

```

```js
$(document).ready(function() {
  $('#select-custom-19').change(function() {
    /* setting currently changed option value to option variable */
    var option = $(this).find('option:selected').val();
    /* setting input box value to selected option value */
    var fruits = $(this).val();
    $('#yourfruit').empty();
    for (var fruit in fruits) {
        var label = $('<label/> ').text(fruits[fruit] + " - ");
        $('#yourfruit').append(label)
                       .append($('<a  class="tab-btn" />').text(fruits[fruit]).attr('href', fruits[fruit] + '.html'))
                       .append('<br />');
    }

  });
});
```

```css
.tab-btn {
  color: red;
}
.tab-btn:hover {
  color: blue;
}
```

```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select name="" multiple="multiple" id="select-custom-19">
  <option>Add Fruits</option>

  <option value="orange" selected>orange</option>
  <option value="apple">apple</option>
  <option value="banana">banana</option>

</select>

<div style="width:300px; height:70px; background-color:#E1D903; 
    color:#000000; margin: 10px; ">
  <span id="yourfruit"> </span>
</div>
```
try below

```
<script src="jquery-mobile/jquery-1.8.3.min.js" type="text/javascript"></script>
<select name="" multiple="multiple" id="select-custom-19">
  <option>Add Fruits</option>
  <option value="orange" selected>orange</option>
  <option value="apple">apple</option>
  <option value="banana">banana</option>
</select>
<div style="width:300px; height:70px; background-color:#E1D903;  color:#000000; margin: 10px; ">
  <ul id="yourfruit">
  </ul>
</div>
<script type="text/javascript">
    $(document).ready( function ()
     {

           $('#select-custom-19').change(function()
           {
        /* setting currently changed option value to option variable */
        var option = $(this).find('option:selected').val();
        /* setting input box value to selected option value */
        $('#yourfruit').append('<li>'+$(this).val()+'</li>');
            }
              );
                 });
    </script>

```