Clickable Div Using Jquery

An update to an old post. I found a much cleaner solution using jquery.

The setup:

<div id="clickable">
  <h2><a href="#">Clickable Text</a></h2>
</div>

Now the jquery:

$(document).ready(function(){

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

});

A nice clean solution that plucks the link from the div and makes the entire thing clickable.

Leave a Reply

Your email address will not be published. Required fields are marked *