title: How to display data from selecting option in drop down
body: <p>From my device table, I have device id, device name and image id and my drop down currently displays the the respective devices. How can I display the image id that is respective to the device selected on. I've tried messing around the code but I'm still going no where.</p>
  
  <pre><code>&lt;select class = "form-control" id="changeDevice" name="changeDevice" &gt;
     &lt;option value= "  -- select a device -- " disabled selected value&gt; -- select a device -- &lt;/option&gt; 
          &lt;?php
            foreach($device as $devicedrop){
            ?&gt;
              &lt;option value="&lt;?php echo $devicedrop['id'] ?&gt;"&gt;
      &lt;?php echo $devicedrop['name'] ?&gt; &lt;/option&gt;
              &lt;?php
              }
              ?&gt;
  &lt;/select&gt;  
      &lt;input type = "text" id="text"&gt;&lt;/input&gt;
  &lt;script&gt;
      $('#changeDevice').find('option:selected').text();
      var text = $(this);
      $('#text').prop(text);
  &lt;/script&gt;
  </code></pre>