Selaa lähdekoodia

Change example to use `script` instead of `textarea`

tags/v1.0.0
Pascal Pfiffner 12 vuotta sitten
vanhempi
commit
4184761b20
1 muutettua tiedostoa jossa 3 lisäystä ja 3 poistoa
  1. +3
    -3
      README.md

+ 3
- 3
README.md Näytä tiedosto

@@ -51,16 +51,16 @@ If you need a template for a dynamic part in a static website, you can consider
<html>
<body onload="loadUser">
<div id="target">Loading...</div>
<textarea id="template" style="display:none;">
<script id="template" type="x-tmpl-mustache">
Hello {{ name }}!
</textarea>
</script>
</body>
</html>
```

```js
function loadUser() {
var template = $('#template').val();
var template = $('#template').html();
Mustache.parse(template); // optional, speeds up future uses
var rendered = Mustache.render(template, {name: "Luke"});
$('#target').html(rendered);


Loading…
Peruuta
Tallenna