When creating functionality that depends on JavaScript, many use a simple link (a element) to create a trigger for the function – you click it and something happens.

That may be ok, though often it would be more appropriate to use <button type="button">Do something</button> or <input type="button" value="Do something" />.

What is not ok is inserting an a element without giving it a non-empty href attribute, i.e. <a href="#">Do something</a>. Without a non-empty href attribute, the “link� will not be focusable and cannot be activated from a keyboard.

Read full post

Posted in , , .