0
Adding hyperlink to JavaScript
Have an ID on HTML file, e.g. apply. How can I add an hyperlink to the ID on JavaScript instead of amending the HTML?
3 Answers
+ 2
document.getElementById('abc'). innerHTML = '<a href = "your_link">abc</a>';
0
Thanks! But having this error âUncaught TypeError: Cannot set property âinnerHTMLâ of nullâ, how can I debug?
0
Use :
onload=()=>{
// your code here
}