title: How to Show selected value on textbox using javascript?
body: <p>How can I show the value of the selected items in the textbox using javascript?</p>
  
  <pre><code>// MY LIST
  &lt;select id="list" class="form-control" multiple=""&gt;
    &lt;option value="2014"&gt;Your Cute&lt;/option&gt;
    &lt;option value="2013"&gt;Your Ugly&lt;/option&gt;
    &lt;option value="2011"&gt;Your Awesome&lt;/option&gt;
  &lt;/select&gt;
  
  // BUTTON and TEXTBOX
  &lt;button onclick="show_value();" type="button" value="Get Value"&gt;Get Value&lt;/button&gt;
  
  &lt;input type="text" id="selectedvalue" class="text" name="selectedvalue" /&gt;
  </code></pre>
  
  <p>I came up with this javascript code</p>
  
  <pre><code>function showgroup_id () {
      $('#selectedvalue').val(selectedvalue);  
      var myList = document.getElementById('list');
      var selected-value = selectedItem;
      var selectedGroupIds = [];
      for (var i = 0; i &lt; myList.length; i++) {
          if (myList[i].selected) {
              selectedselectedItem.push(myList[i].value);             
          }
      }
  }
  </code></pre>
  
  <p>When I tried, it doesn't work.. anyone can help me please?</p>