I use this sometimes to have all outside links open in a new tab/window. $('a[href^="http"]') .not('[href*=' + window.location.hostname + ']') .attr('target', '_new');
You could modify that: $('a[href^="http"]') .not('[href*=' + window.location.hostname + ']') .each(function() { ... }); On Wed, Jan 14, 2009 at 9:54 AM, km...@fensys.com <seig...@gmail.com> wrote: > > I need to capture all links that navigate away from the current page. > If a link points back to the current page, it is allowed to go > through. If it navigates away, a popup needs to appear displaying > certain information. I have two different strings that point pack to > the current page. One is a normal url, the other is a javascript > postback. > > On Jan 13, 10:20 pm, brian <bally.z...@gmail.com> wrote: >> You could maybe follow with not(). What are you trying to do? >> >> On Tue, Jan 13, 2009 at 5:26 PM, km...@fensys.com <seig...@gmail.com> wrote: >> >> > I'm using a attribute selector and I want to combine the *= with the ! >> > = on href. Is there any way to do this?