Skip to content

Instantly share code, notes, and snippets.

@psflannery
Created June 18, 2013 15:27
Show Gist options
  • Save psflannery/5806339 to your computer and use it in GitHub Desktop.
Save psflannery/5806339 to your computer and use it in GitHub Desktop.
Here’s an easy way to make the parent div of a link clickable. Let’s say you have this html code - http://css-tricks.com/snippets/jquery/make-entire-div-clickable/
/**
<div class="myBox">
blah blah blah.
<a href="http://google.com">link</a>
</div>
*/
$(".myBox").click(function(){
window.location=$(this).find("a").attr("href");
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment