JavaScript
Article
By Sam Deering

Make Entire Div Clickable

By Sam Deering

Simple jQuery code snippet to make a div element into a hyperlink so that the user can click anywhere inside and be directed to the link href.

--ADVERTISEMENT--

$(".myBox").click(function(){
     window.location=$(this).find("a").attr("href");
     return false;
});
Login or Create Account to Comment
Login Create Account
Recommended
Sponsors
Get the most important and interesting stories in tech. Straight to your inbox, daily.