title: HTML & jQuery get href
body: <p>I'm new to this website so I'm sorry if I do something wrong, please tell me if I do so.</p>
  
  <p>Problem: I'm trying to get a href from the current page I'm on with a button like "Get Href" and when it manages to get a href it will display text <em>Href gotten</em> or if it fails it says <em>Href not found</em>. If it does find it a new button appears which says <em>Goto Href</em> and that takes the user to the href. I've been searching the whole week for a solution but so far I have no luck. Also this is a chrome extension.</p>
  
  <p>Useful Links Found So Far:</p>
  
  <ul>
  <li><strong><a href="https://stackoverflow.com/questions/8925756/need-to-link-directly-to-a-chrome-internal-page-from-within-a-page-of-a-chrome">Need to link directly to a Chrome internal page, from within a page of a Chrome Extension</a></strong></li>
  <li><strong><a href="https://stackoverflow.com/questions/303956/select-a-which-href-ends-with-some-string">Select  which href ends with some string</a></strong> - Can be used to find href starts with <a href="http://api.jquery.com/attribute-starts-with-selector/" rel="nofollow noreferrer">^=</a></li>
  <li><a href="https://developer.chrome.com/extensions/content_scripts" rel="nofollow noreferrer"><strong>Content Scripts</strong></a></li>
  </ul>
  
  <p>I am new to HTML &amp; jQuery &amp; CSS &amp; Javascript so I apologize for my lack of knowledge in advance. If you are able please explain your answers in detail. If answer is found please comment the functions out so I could manually research them further.</p>
  
  <p>I don't know where to start, what I have so far is what the <strong>Getting Started: Building a Chrome Extension</strong> has.</p>
  
  <h1>----UPDATE .1----</h1>
  
  <p>I thank you for your replies and what I've gathered so far from them is this code</p>
  
  <pre><code>&lt;script&gt;
  $(document).ready(function(){
    $("button").click(function(){
      alert($('a').attr('href'));
    });
  });
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;button&gt;Find Href&lt;/button&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>but nothing seems to happen. Also instead of <code>alert($('a').attr('href'));</code> I'm trying to put <code>$('a[href^="magnet"]')</code> This code is gathered from different websites so I don't know if it is legit (still working) or not.</p>