Sure, that's even easier. Since jQuery works with CSS selectors you could target links in dozens of ways. Each of the following code blocks should be placed in a document.ready function like above:
Code:
$("a.foo").click(function() {
// do stuff
});
This will let you hook into any link on the website with a class of foo. This is generally how I would do it.
Code:
$(".ce_text a").click(function() {
// do stuff
});
This will target links only within a ce_text element (most likely a div, according to TL's default templates).
Code:
$("a[href*='extDomain']").click(function() {
// do stuff
});
You'll like this one. This will target any link that contain the string 'extDomain' in the href attribute. Sounds like this will be exactly what you need. Attribute selectors in jQuery are incredibly powerful - especially when you're dealing with many content editors who may not remember to set certain classes or hooks you depend on.
If you have any links that are dynamically added to the page after load, you will have to use the live function. Just replace .click(function() { with .live("click", function() {
Bookmarks