Skip to content

Instantly share code, notes, and snippets.

@JavaScript-Packer
Created July 23, 2015 05:01
Show Gist options
  • Select an option

  • Save JavaScript-Packer/dbda82aae980f0e5b121 to your computer and use it in GitHub Desktop.

Select an option

Save JavaScript-Packer/dbda82aae980f0e5b121 to your computer and use it in GitHub Desktop.
Better alternative for document.write() in JavaScript using createElement div document.body.appendChild
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script>
var div = document.createElement("div");
div.innerHTML = '<a href="http://www.whak.ca">www.WHAK.ca</a>';
document.body.appendChild(div);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment