Creating a link with JavaScript

Using this JavaScript snippet makes it possible to create a link out of a  non-link element:

<div id="fakeLink" onclick="location.href='url'"></div>

But the above code does not convert the cursor to a hand, so it is best practice to do in with CSS  in order for the users to be able to see the hot spot.

#fakeLink {
   cursor:pointer;
}

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>