![]() |
An HTML link, a hyperlink, connects one web page to another. Users who click an HTML link are taken to the corresponding web page. Web developers can link to text, images, and other media using HTML links. These are the following approaches: Table of Content Using the href Attribute with a Placeholder ValueThis method uses the href property with a placeholder value, such as “javascript: void(0)“, to generate a link that does not redirect to a different page or URL. Example: Creating an HTML link that doesn’t follow the link Using the href Attribute with a Placeholder Value.
Output: ![]() Output Using the href Attribute with an Empty ValueIn this approach, we are using the href attribute left blank, resulting in a link that does not navigate when clicked. Example: Creating an HTML link that doesn’t follow the link Using the href Attribute with an Empty Value
Output: ![]() Output Using the onclick Event HandlerIn this approach, when the link is clicked, this method executes JavaScript code via the `onclick` event handler. Returning false from the JavaScript function prevents the link’s default action. Example: Creating an HTML link that doesn’t follow the link Using onclick Event Handler.
Output: ![]() Output |
Reffered: https://www.geeksforgeeks.org
HTML |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 16 |