Skip to content

Instantly share code, notes, and snippets.

@niceaji
Created March 24, 2015 06:07
Show Gist options
  • Save niceaji/d4e7bd01aa33bae982b7 to your computer and use it in GitHub Desktop.
Save niceaji/d4e7bd01aa33bae982b7 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>template</title>
</head>
<body>
<div id="greeting"></div>
<script type="text/template" id="greetingTemplate">
<u>Hello~ {nick}</u>
</script>
<script>
var nick = "hulk";
var template = document.getElementById('greetingTemplate').innerHTML;
var helloHtml = template.replace("{nick}", nick)
document.getElementById('greeting').innerHTML = helloHtml;
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment