How to make a div clickable using jquery
by Nikhil Mangal
HTML
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<div class="clickable-div">
<a href="http://www.google.com">Click Here</a>
</div>
CSS
.clickable-div
{
width:400px;
padding:50px;
text-align:center;
background:#CC9900;
cursor:pointer;
}
.clickable-div a
{
color:#333;
text-decoration:none;
font-weight:bold;
}
JavaScript
$(document).ready(function(e) {
$('.clickable-div').click(function(){
$href=$(this).find("a").attr("href");
window.location=$href;
return false;
});
});