jquery tip: attach listener to body tag
$("body").on("click", "a", function(event) {
... your custom code
.... this attaches the listener to the body, but will match against any click from an <a> tag.
.... so you don't have to attach to every a tag every time, but can use only 1 listener
... also good, because you can attach the listener to a parent element and not have to update the listners whenever a new <a> tag is created
});
description
$("<SELECTOR to attach to>").on("< event name>", "<selector for event sources>", <your function handler for that event >);