Name

Link.onclick: event handler invoked when a Link is clicked — DOM Level 0

Synopsis

Function onclick

Description

The onclick property of a Link object specifies an event-handler function that is invoked when the user clicks on the link. The browser default action after the event handler returns is to follow the hyperlink that was clicked. You can prevent this default by returning false or by using one of the other event-cancellation methods described in Chapter 17.

See Also

Element.addEventListener( ), MouseEvent; Chapter 17

Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.