Skip to content

Commit

Permalink
[doc] udpate
Browse files Browse the repository at this point in the history
  • Loading branch information
Paolo Fragomeni committed Nov 29, 2011
1 parent 1fc8296 commit 0e8e4b7
Showing 1 changed file with 24 additions and 15 deletions.
39 changes: 24 additions & 15 deletions README.md
Expand Up @@ -50,28 +50,37 @@ Include the script somehow wherever you are going to use it.
<script type="text/javascript" src="plates.js"></script> <script type="text/javascript" src="plates.js"></script>
``` ```


Take some markup, some data, bind them, done. Here's a contrived example using jQuery.


```html ```html


<script type="text/javascript"> <html>
<head>
<script type="text/javascript">
var html = $('#template1')[0];
var data = { "template1": "New Value" };
var output = Plates.bind(html, data);
$('#template1').html(output);
$('#ui')
var html = '<div id="test">Old Value</div>'; </script>
var data = { "test": "New Value" }; <style>
.templates { display: none; }
</style>
<body>


var output = Plates.bind(html, data); <div class="templates">
<div id="template1">Old Value</div>
</div>


// <div class="ui">
// with the output, append it to the current document or use it however you want. </div>
// </body>
... </html>
document.body.appendAdjacentHTML(output); // append this to the DOM using native DOM APIs.
...
$('body').appendChild(output);
...


</script>

``` ```


### Defining explicit instructions for matching data keys with html tags. ### Defining explicit instructions for matching data keys with html tags.
Expand Down

0 comments on commit 0e8e4b7

Please sign in to comment.