« WTF | Main | Four years ago today... »

October 24, 2006

Note to self...

If you want an anchor tag with out an href that responds to an onclick but want it to look like and act like an anchor tag that has an href just use the tabindex property and set it's value to 0 and style it like so:
a:hover {cursor: pointer;}
Example link: Click Me!
Source:
<a tabindex=0 onclick="alert('You clicked me! Pervert!'); return false;" style="a:hover {cursor:pointer;}">Click Me!</a>

Of course the stylesheet for my blog screws the pointer styling up here, but it does work. Really.

Posted by ed at October 24, 2006 4:08 PM

Comments

Post a comment




Type the characters you see in the picture above.


Remember Me?