Skip to content

Instantly share code, notes, and snippets.

@cb99999
Last active December 7, 2018 05:34
Show Gist options
  • Save cb99999/5867070 to your computer and use it in GitHub Desktop.
Save cb99999/5867070 to your computer and use it in GitHub Desktop.
jquery -> make entire div a clickable link
<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