Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2009
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    JavaScript fires on first event then stops working...

    In the doc.ready I have the following...

    $("a").click( function(e) {
    alert('hey');
    });

    With a freshly loaded page, this works the first time you click on a link and then doesn't alert when you click another link.

    Can someone tell me what I'm missing?

    Thanks!

  • #2
    Regular Coder
    Join Date
    Dec 2008
    Location
    Tannhäuser Gate
    Posts
    286
    Thanks
    7
    Thanked 58 Times in 57 Posts
    You've missed that.

    Post your code, properly formatted with CODE tags. [if $ is a shortcut for getElementById, it is going to work only on one link]


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •