Strange trouble with jQuery click function..


I use this code to make the whole div of my menu-links clickable:
$(".menudiv").click(function(){window.location=$(this).find("a").attr("href");return false;});
works great.

on the page i have 2 .png arrows, 1 for left navigation, 1 for right. Because these arrows have a lower z-index i put a div on top of them to make them clickable.

to do this, i use this code:
$(".arrowwrap").click(function(){window.location=$(this).find("a").attr("href");return false;});
this works great for the right arrow, right-navigation works.

now the strange part. when the left arrow is clicked the page only refreshes or something. so the link does not work.

the site has 5 pages. 4 with arrows to the left or right, the index.php has no arrows.
another strange thing is that the left arrow on the first page with arrows DOES work. this links back to the index page.

Please help me, this drives me crazy.

My arrow structure looks like this:

#page-wrap .arrowwrap{
	#page-wrap .arrowwrap .arrow{
		margin:30px 15px;

<div id="left2">
    <div class="arrowwrap">
        <div class="arrow">
            <a href="index.php"><img src="layout/arrow-left-5.png" width="200" height="450" alt="kdj"></a>

<div id="right2">
    <div class="arrowwrap">
        <div class="arrow">
            <a href="page2.php"><img src="layout/arrow-right-5.png" width="200" height="450" alt="kdj"></a>          	  	

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

in the right2 div you wrote <a href="page2.php"> and in the left2 div : <a href="index.php">  
isn't should be <a href="page1.php"> or somthing
how you get the link page2.php there might be the problem, the pagination method you are using not from jQuery

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
peps03Author Commented:
thanks for your reaction mhmr.

no, i this example:
in the right2 div you wrote <a href="page2.php"> and in the left2 div : <a href="index.php">  
i'm on page1. left arrow links to index, right arrow to page 2.

this makes the divs containing the arrows clickable according to the links inside them:
$(".arrowwrap").click(function(){window.location=$(this).find("a").attr("href");return false;});

all the right-arrows work. the left-arrow on page 2, 3 and 4 only don''t work

the left arrow on page 1 links to the index, this works strange enough. the left-arrow on page 2 linking to page1 doesn't work. (same for page 3 and 4)
peps03Author Commented:
After all you where right.
Stupid enough i did link the page to itself on the left arrow. that is way it was refreshing... so stupid.
but thanks for your view!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.