Make a Div Into a Link

It’s easy to make any div into a link by using a bit of javascript. You can use this technique to make any div “clickable”. For example, you might want your “header” div to link to your home page. Here’s how it’s done.

<div onclick="location.href='http://www.example.com';" style="cursor:pointer;"></div>

you can make your header div clickable by using this code:

<div id="header" onclick="location.href='<?php bloginfo('url');?>';" style="cursor:pointer;"></div>

Leave a comment