Created
June 18, 2013 15:27
-
-
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/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
<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