I have two div's which I would like to be clickable. Each div has an anchor link within which I would like to use for each div's link.
I'm using the help below which works for the left div but not the right. http://css-tricks.com/snippets/jquery/make-entire-div-clickable
Not quite sure what I'm missing or if there is a better way to do this? Ideally I would like to use just CSS but this option would still work even if js is disabled.
Any help would be great.
$('.left').click(function(){
window.location=$(this).find("a").attr("href");
return false;
});
$('.right').click(function(){
window.location=$(this).find("a").attr("href");
return false;
});
<div class="left">
<div class="left-content">
<h2><a href="#">title</a></h2>
<ul>
<li>Link</li>
<li>Link</li>
<li>Link</li>
</ul>
</div>
</div>
<div class="right">
<div class="right-content">
<h2><a href="#">title</a></h2>
<ul>
<li>Link</li>
<li>Link</li>
<li>Link</li>
</ul>
</div>
</div>