title: how to pop up the alert when click the link
body: <p>i am newbie with html and jquery. i want to show an alert box when click the link. but seems the jquery function doesn't work. 
  not sure the selector or something else is wrong. </p>
  
  <p>please suggest. thanks.</p>
  
  <pre><code>&lt;html&gt;
  
      &lt;head&gt;
          &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"&gt;&lt;/script&gt;
      &lt;/head&gt;
  
      &lt;body&gt;
          &lt;p&gt;text1&lt;/p&gt;
          &lt;p&gt;text2&lt;/p&gt;
          &lt;p&gt;text3&lt;/p&gt;
  
          &lt;input type=button onClick="location.href='http://www.test.com/?test=123'" value='click here'&gt;
  
          &lt;div class="modify"&gt;
              &lt;a href="http://www.test.com" id="myHref"&gt;test1&lt;/a&gt;
              &lt;p/&gt;
              &lt;a href="http://www.test.com" id="myHref"&gt;test2&lt;/a&gt;
              &lt;p/&gt;
              &lt;a href="#" id="myHref1" class="button mini-button blue"&gt;test3&lt;/a&gt;
          &lt;/div&gt;
  
          &lt;script type="text/javascript"&gt;
              function ($) {
                  alert('test');
              }
              $self.find("#myHref").each(function () {
                  $(this).on("click", function () {
                      var $this = $(this),
                      alert ($this.attr('href'));
                  });
              });
          &lt;/script&gt;
      &lt;body&gt;
  &lt;/html&gt;
  </code></pre>