Skip to content

Multiple href in one link example | JS Code

  • by

You can’t Multiple href in one link HTML alone, because there’s only a single href attribute. Use the method in JavaScript:

Multiple href in one link In JavaScript

Complete example code:

In Anchor tag


	<a href="#" onclick="'');'');">


In Script

In function call‘url’). Example code creates a multiple links for a single <a href> tag.


	<a href="#" onclick="yourlink()">Click Here</a>


		function yourlink() {

			var locs = ['','',''] 

			for (let i = 0; i < locs.length; i++) {[i])}



Multiple href in one link example

Do comment if you have any doubts or suggestions on this JS code.

Note: The All JS Examples codes are tested on the Firefox browser and the Chrome browser.

OS: Windows 10

Code: HTML 5 Version

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.