[jQuery] Re: set default action for all links
On Fri, Nov 21, 2008 at 11:28 AM, Pierre Bellan <[EMAIL PROTECTED]> wrote: > Hi, > > I don't know what lightbox is but it's not important. > Like you said, you just need an selector for all links. > > $('a').click(function(){ > myUrl = $(this).attr('href'); > openLightbox(myUrl); > }); Don't forget the var keyword for myUrl, and return false; so the link doesn't get followed. $('a').click(function(){ var myUrl = $(this).attr('href'); openLightbox(myUrl); return false; }); - Richard
[jQuery] Re: set default action for all links
Hi, I don't know what lightbox is but it's not important. Like you said, you just need an selector for all links. $('a').click(function(){ myUrl = $(this).attr('href'); openLightbox(myUrl); }); I think this code works, but i have not test it. Pierre Yogi Berra - "I never said most of the things I said." 2008/11/21 EC <[EMAIL PROTECTED]> > > Hi, i would like to know if is possible to set a default action for > all href in a page... > > I know i can use selectors to find all href but i don't know what to > put in function. > > I just would like that all link open in a lightbox... > > Someone can help me? > > Thanks >