Last active
December 7, 2018 05:34
-
-
Save cb99999/5867070 to your computer and use it in GitHub Desktop.
jquery -> make entire div a clickable link
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
<script> | |
jQuery(document).ready(function($) { | |
/*---------------------------- | |
make entire div clickable | |
-----------------------------*/ | |
$(".myBox").click(function(){ | |
window.location=$(this).find("a").attr("href"); | |
return false; | |
}); | |
}); | |
</script> | |
<div class="myBox"> | |
blah blah blah. | |
<a href="http://google.com">link</a> | |
</div> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment