title: How to build a chrome extension to highlight text on a specific URl
body: <p>I am relatively new to both programming and developing chrome extensions. I am developing a chrome extension that will do this simple  thing.</p>
  
  <ol>
  <li>On selecting a text, show a button on clicking which the text will be highlighted. (Somewhat like the pin button)</li>
  <li>When i revisit the page I can see what where the areas i highlighted.</li>
  </ol>
  
  <p>So currently I have a extension working which can save the bookmark to the database. This is the link from which i got this understanding <a href="http://markashleybell.com/building-a-simple-google-chrome-extension.html" rel="nofollow">http://markashleybell.com/building-a-simple-google-chrome-extension.html</a>. If you want i can share the actual code also but it is going to crowd the question.</p>
  
  <p>I think I can make get the selected text to go in to the database if i use contextmenus. But this is what i intend to do is </p>
  
  <ol>
  <li>select the text</li>
  <li>A icon comes up (H<strong>ow do i trigger the jquery to add the button, which chrome api i need to use and in which file i should put the code)</strong>
  3 On clicking the icon the text gets highlighted. (<strong>how should i change the DOM of the current page)</strong></li>
  </ol>
  
  <p>I can do the part of extracting the text and sending it to the Database. </p>
  
  <p>The next problem i have no idea about what information I need to store in the database (Example do i need to store the start or end node) so that i can have the text highlighted when i return to the URl. <strong>How does a chrome extension start on its own to figure out what part of the page need to be highlighted.</strong> </p>
  
  <p>In case you have a sample code that will be great or just tell me what is the logic and chrome api's i need to use.</p>
  
  <p>I know the question is too broad but even if you have a few links that can help to understand this flow it will be great. <strong>The project i am working on it to create a far similar version of <a href="https://www.diigo.com/" rel="nofollow">https://www.diigo.com/</a>, with just the ability to store URL along with the highlighted notes.</strong></p>