title: how to get the selected value of a dropdown which is inside a bootstrap modal into a textbox in php
body: <p>[<img src="https://i.stack.imgur.com/VrXGM.jpg" alt="It&#39;s a Modal Box where selected text of a dropdown not showing in the textbox on change ">]</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>   $( "#ddlcolors" ).change(function() {
      var sel = $( "#ddlcolors option:selected" ).val();
      var textbox = document.getElementById("txtmanuid");
      textbox.value =$( "#ddlcolors option:selected" ).text();
     });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.3/jquery.min.js"&gt;&lt;/script&gt;
  &lt;button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#myModal"&gt;Launch modal&lt;/button&gt;
  
    &lt;!-- Modal --&gt;
    &lt;div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"&gt;
      &lt;div class="modal-dialog" role="document"&gt;
     &lt;div class="modal-content"&gt;
       &lt;div class="modal-header"&gt;
      &lt;button type="button" class="close" data-dismiss="modal" aria-label="Close"&gt;&lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;&lt;/button&gt;
      &lt;h4 class="modal-title" id="myModalLabel"&gt;Modal title&lt;/h4&gt;
       &lt;/div&gt;
       &lt;div class="modal-body"&gt;
      &lt;select required id="ddlcolors" class="text-success form-control input-sm"&gt;
       &lt;option class="text-success" selected disabled value=""&gt;&lt;h6&gt;-- Select Colors --&lt;/h6&gt;&lt;/option&gt;
       &lt;option class="text-success text-center" value="R"&gt;Red&lt;/option&gt;
       &lt;option class="text-success text-center" value="G"&gt;Green&lt;/option&gt;
       &lt;option class="text-success text-center" value="B"&gt;Blue&lt;/option&gt;
       &lt;option class="text-success text-center" value="O"&gt;Orange&lt;/option&gt;
      &lt;/select&gt;
      &lt;input type="text" readonly id="txtmanuid" &gt;
       &lt;/div&gt;
       &lt;div class="modal-footer"&gt;
       &lt;/div&gt;
     &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here what i am trying to achieve: whenever value of a dropdown changes, that same value should be shown in the textbox, which is right next to it. </p>
  
  <p>Please help ??</p>