title: Get the selected text of a web page in google chrome extension
body: <p>I am developing a Google Chrome extension. When a popup is clicked, I would like the input box present in the popup.html file to contain the selected text of the current webpage.</p>
  
  <p>Example textbox:</p>
  
  <pre><code>&lt;input id="searchBox" type="text" /&gt;
  </code></pre>
  
  <p>When text is selected in a webpage, the textbox should contain the selected word. I tried with <code>chrome.extension.getBackgroundPage().getSelection()</code> but it is not working.</p>