What is the usage of <a href="javascript:;" title="PDF">PDF</a>?

ypsd

When I click it if will pop up a div (by changing its style from "display: none;" to "display: block;" through the modification css attributes).

This look weird to me, as I don't how an empty javascript statement can cause changes to the webpage. Does anybody have any clue how it can happen? Thanks!

xelawho

it's just an obsolete way of doing things. A more modern approach would be

<a href="#" onclick="return false" title="PDF">PDF</a>

or better, to make a <span>, style it how you like and add an onclick later

ypsd

xelawho;1242775 wrote:

it's just an obsolete way of doing things. A more modern approach would be

<a href="#" onclick="return false" title="PDF">PDF</a>

or better, to make a <span>, style it how you like and add an onclick later

Can you help create a minimal working example (with the complete code) to make a div visible? I don't quite get why empty javascript command can cause changes to the webpage. A working example can help me better understand what is going on. Thanks!

ReFreezed

There is certainly more code elsewhere that defines the behavior to the <a> tag. Here's a small example: