How can I add the href attribute to a link dynamically using JavaScript?
href
I basically want to add a href attribute to
document.getElementById('link-id').href = "new-href";
I know this is an old post, but here's a one-liner that might be more suitable for some folks.