title: add value to input field automatically
body: <p>How to add values automatically without add button? Just select value from dropdown and do it again and again to add them to the same input <a href="https://i.stack.imgur.com/HKd6B.png" rel="nofollow noreferrer">like on image</a>.</p>
  
  <p><code>html</code></p>
  
  <pre><code>&lt;select name="programs_dropdown" id="programs_dropdown"&gt;
  &lt;option value="php"&gt;php&lt;/option&gt;
  &lt;option value="jquery"&gt;jquery&lt;/option&gt;
  &lt;option value="html" selected="selected"&gt;HTML&lt;/option&gt;
  &lt;/select&gt;
  
  &lt;div id="add"&gt;Add&lt;/div&gt;
  
  &lt;input type="text" name="programs_input" id="programs_input" /&gt;
  </code></pre>
  
  <p><code>jquery</code></p>
  
  <pre><code>$(document).ready(function(){
      $('#add').click(function() {
          var program = $("#programs_dropdown").val(); //get value of selected option
          var programs = $('#programs_input').val().split(",");
          if (programs[0] == "") {
              programs.pop()
          }
  
          if ($.inArray(program, programs) == -1) {
              programs.push(program);
          }
  
          $('#programs_input').val(programs.join(',')); //add to text input
      }); 
  });
  </code></pre>