/ Published in: jQuery
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$(".myBox").click(function(){ window.location=$(this).find("a").attr("href"); return false; }); Looks for a link inside div with class of "myBox". Redirects to that links value when anywhere in div is clicked. Reference HTML: <div class="myBox"> blah blah blah. <a href="http://google.com">link</a> </div>
URL: http://css-tricks.com/snippets/jquery/make-entire-div-clickable/