Skip to content

Instantly share code, notes, and snippets.

@curtis
Created June 13, 2010 21:12
Show Gist options
  • Save curtis/437011 to your computer and use it in GitHub Desktop.
Save curtis/437011 to your computer and use it in GitHub Desktop.
Setting the inner HTML and href attribute of an anchor tag using JavaScript
var link = document.createElement('a');
link.innerHTML = "http://flatterli...";
link.href = "http://flatterline.com";
@sagarishere
Copy link

Thanks for this one. It was difficult to find the correct syntax to replace url chars.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment