Created
September 9, 2013 21:19
-
-
Save dyaa/6501677 to your computer and use it in GitHub Desktop.
Make Entire Div Clickable Looks for a link inside div with class of "myBox". Redirects to that links value when anywhere in div is clicked.
This file contains 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> |
This file contains 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
$(".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