I'm trying to get hold of the prev/next-objects when clicking a link from within the #menu. I've tried all sorts of .prev(), .prevUntil() a.s.o but so far I haven't had any luck with it :)
$('#menu a').click(function(){ // get the parent.a object so i can send send it to the #prev container as <a href="pageX">pageX</a> // get the next.a object so i can send it to the #next container as <a href="pageX">pageX</a> });
If possible the script should ignore the table,tr,td,ul & li items, the menu structur/html can change in the future (its can be user-configured) - if not, no worries :)
$('#menu a').click(function(){ var theLink = $(this).parent().siblings().children('a').attr('href'); // do whatever you want with the theLink variable });
The idea is that clicking "page2" will set "prev" = "page1" and "next" = "page3", clicking "page1" will set "next" to "page2" and "prev" to null, and so on.
I managed to make a "hey it works" version yesterday that runs a $('#menu a').each and then sets the $prev and $next, but it feels a bit clumsy and php'ish.
I'm trying to get hold of the prev/next-objects when clicking a link from within the #menu.
I've tried all sorts of .prev(), .prevUntil() a.s.o but so far I haven't had any luck with it :)
My current layout is:
jquery:
If possible the script should ignore the table,tr,td,ul & li items, the menu structur/html can change in the future (its can be user-configured) - if not, no worries :)
Firebug says:
The idea is that clicking "page2" will set "prev" = "page1" and "next" = "page3", clicking "page1" will set "next" to "page2" and "prev" to null, and so on.
I managed to make a "hey it works" version yesterday that runs a $('#menu a').each and then sets the $prev and $next, but it feels a bit clumsy and php'ish.