views:

194

answers:

1

I am binding the click event to 4 href's (they have class="alink") using JQuery in the ready() event like this: $(".alink").click(function() { debugger; });

I expect whenever I click on a link, the event fires. However what I notice is that sometimes it doesn't fire and when it fires, it fires 4 times. Am I not doing it right?

EDIT:

<div id="nav">
        <ul>
          <li class="current"><a href="default.aspx" title="Home" class="alink">home</a></li>
          <li><a href="faq.aspx"  class="alink">faq</a></li>
          <li><a href="" title="Webmail" class="alink">webmail</a></li>
          <li><a href="contactus.aspx" title="contact" class="alink">contact us</a></li>
        </ul>
      </div>
A: 

Actually I found the problem. The event handler was inside another function!

Tony_Henrich