Skip to content

Instantly share code, notes, and snippets.

@mayuki
Created March 25, 2010 03:09
Show Gist options
  • Select an option

  • Save mayuki/343129 to your computer and use it in GitHub Desktop.

Select an option

Save mayuki/343129 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html xml:lang="ja" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
<title>jquery-template-test1</title>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="http://github.com/nje/jquery-tmpl/raw/master/jquery.tmpl.js"></script>
<script type="text/javascript">
function render() {
$('#output')
.append('#template1', { value: 'Hauhau1' })
.append('#template2', { value: 'Hauhau2' })
.append('#template3', { value: 'Hauhau3' })
.append('#template4', { value: 'Hauhau4' })
;
}
</script>
</head>
<body>
<!-- Templates -->
<script type="text/html" id="template1">
<p>Value: {%= value %}</p>
</script>
<script type="text/html" id="template2">
Value: {%= value %}
</script>
<script type="text/html" id="template3">
Value: <strong>{%= value %}</strong>
</script>
<script type="text/html" id="template4">
/* value: {%= value %} */ input
</script>
<!-- /Templates -->
<input type="button" value="Render!" onclick="render();" />
<hr />
<h2>Output</h2>
<div id="output" style="border: 1px solid black;"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment