Make your whole Divs clickable.

Want to make your whole div clickable?

There is no need to add div within anchor tag (i.e. <a href=”#”>..</a>). By below code you can make your whole div clickable.

By using JavaScript:

<div onclick=”location.href=’Enter-URL-Here’;” ></div>



By using jQuery:


<h3>Your text to show</h3>

<a href=””>Site link</a>




window.location= $(this).find(“a”).attr(“href”);


Note: Don’t forget to add jquery library before using jQuery (This is common mistake that I also did while coding 😛 )

Written by Ranjeet Jha

Ranjeet Jha

Hey there! My name is Ranjeet. I’m a Web Designer & Front-end Developer. I design, code, build & promote all things HTML5, CSS3, JavaScript & jQuery. In this blog you will find solutions of day to day problems faced by you.. Enjoy Coding..

Leave a Reply

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