Skip to content
Advertisement

How can I add “href” attribute to a link dynamically using JavaScript?

How can I add the href attribute to a link dynamically using JavaScript?

I basically want to add a href attribute to <a></a> dynamically (i.e. when the user clicks on specific image in the website).

So from:

JavaScript

I need to go to:

JavaScript

Advertisement

Answer

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement