Hi Jesper, you might be interested in this: http://dev.jquery.com/ticket/2164
-- Bohdan Ganicky On Jan 17, 11:00 am, "Jesper Rønn-Jensen" <[EMAIL PROTECTED]> wrote: > I made a script that makes a div clickable by selecting all <div > class="click"> and setting the onclick event to go to the href of a > link. Everything worked when i selected the first links href > attribute. > This works and selects the first a element: > location.href = $(this).children('p').children('a')[0].href; > > But I made a HTML change and now want to select the last a element's > href attribute. However I must be messing up something. This does not > work: > location.href = $(this).children('p').children('a')[$ > (this).size()-1].href; > Which unfortunately also picks the first A element and not the last > one as intended. I also tried the most intuitive (for me), but there > is no .last() method defined so this doesn't work either: > > location.href = $(this).children('p').children('a').last().href; > => $(this).children("p").children("a").last is not a function > > I'm using JQuery 1.2.1and the solution must work in FF2, IE6, IE7. I > am not able to count the links, and I prefer not swapping around the > html elements, as it would require absolute positioning that might > mess other stuff up. > > Considering these constraints, what are my options? > Any suggestions? > > Thanks in advance! > > /Jesper Rønn-Jensenwww.justaddwater.dk