I have a javascript variable BASE_URL='http://localhost/BKTHP_WEB_NEW/';
Now I want to insert it inside a
something like <a href="BASE_URL+\view">
I have a javascript variable BASE_URL='http://localhost/BKTHP_WEB_NEW/';
Now I want to insert it inside a
something like <a href="BASE_URL+\view">
Use setAttribute
to set the variable as a value for href
var BASE_URL='http://localhost/BKTHP_WEB_NEW/';
document.querySelector('a').setAttribute('href',BASE_URL)
<a href="">Link
You can use setAttribute
on your a tag, and set the href
dynamically
<a id="replace" href="">YOUR LINK</a>
const BASE_URL='http://localhost/BKTHP_WEB_NEW/';
document.querySelector('#replace').setAttribute('href', BASE_URL);