jquery method to make the entire div area clickable

  • 2020-06-22 23:44:57
  • OfStack

This article illustrates how jquery makes the entire div area clickable. Share to everybody for everybody reference. The specific analysis is as follows:

The implementation lets the user click through the entire div area, which automatically looks for links in div


$(".myBox").click(function(){
   window.location=$(this).find("a").attr("href");
   return false;
});

Reference HTML:


<div class="myBox">
   blah blah blah.
  <a href="http://google.com">link</a>
</div>

I hope this article has been helpful for your jQuery programming.


Related articles: