Home Set Hyperlink to a Variable- update variable all hyperlinks update
Reply: 0

Set Hyperlink to a Variable- update variable all hyperlinks update

user8598 Published in September 20, 2018, 12:43 pm

I have a website where there is the same hyperlink(URL) shown on multiple pages and different locations. How can I set the hyperlink to a variable, store that variable somewhere then when I need to change the URL all I need to do is update the variable resulting in all hyperlinks pointing to that variable updating as well. rather than manually changing the hyperlink on every location on the site?

Hope this makes sense,

please post answers using the following methods 1- HTML 2- JavaScript 3-JQuery 4- (something I forgot to add to list but is easy to implement)

share|improve this question
  • 1
    Don't know if it is possible to do in a pure HTML. Instead, you can use JQuery in such way. Assume you have a <div id="element">: var hyperLink = '<a href="http://google.com'>Google</a>"; var element = $('#element'); element.append(hyperLink);. – Alex Zakruzhetskyi Feb 12 at 15:46
  • append? that would replace the var hyperlink to the var element? I am not a web developer but got stuck with this task :\ – NULL.Dude Feb 12 at 15:50
  • It will add a hyperlink to the div – Alex Zakruzhetskyi Feb 12 at 15:50
  • staticgen.com – Quentin Feb 12 at 15:51

1 Answer 1

active oldest votes
up vote 1 down vote accepted
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.617941 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO