Return to Snippet

Revision: 46327
at May 17, 2011 19:35 by dubogii


Initial Code
$(".myBox").click(function(){
     window.location=$(this).find("a").attr("href");
     return false;
});

Looks for a link inside div with class of "myBox". Redirects to that links value when anywhere in div is clicked.






Reference HTML:

<div class="myBox">
     blah blah blah.
    <a href="http://google.com">link</a>
</div>

Initial URL
http://css-tricks.com/snippets/jquery/make-entire-div-clickable/

Initial Description


Initial Title
Make Entire Div Clickable

Initial Tags


Initial Language
jQuery