Home  >  Article  >  Web Front-end  >  jquery method to make the entire div area clickable_jquery

jquery method to make the entire div area clickable_jquery

WBOY
WBOYOriginal
2016-05-16 15:52:581092browse

The example in this article describes how jquery makes the entire div area clickable. Share it with everyone for your reference. The specific analysis is as follows:

The implementation here allows the user to click on the entire div area, and this code will automatically find the link in the 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 will be helpful to everyone’s jQuery programming.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn