Hacker News new | ask | show | jobs
by talmand 2887 days ago
Well, it could be. As long as #foo exists on the page at the time that line is executed. If you inject #foo into the page after load then the click event won't work.

The jquery example delegates #foo, so it can be injected in the page after load and the click event will still work.

But there are ways to mimic the behavior as another person has pointed out.