Skip to content

Instantly share code, notes, and snippets.

@pure
Created March 16, 2011 00:05
Show Gist options
  • Save pure/871767 to your computer and use it in GitHub Desktop.
Save pure/871767 to your computer and use it in GitHub Desktop.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://github.com/pure/pure/raw/master/libs/pure.js"></script>
</head>
<body>
<div id="test">
<div class="field">
<label></label>
</div>
</div>
<script>
var data = {
"Fields": {
"User_Name": {
"FieldName": "User_Name",
"Caption": "User Name",
"HTMLTemplate": "<input type=\"text\" value=\"\" maxlength=\"\" autocomplete=\"off\" name=\"\" id=\"\">"
},
"Password": {
"FieldName": "Password",
"Caption": "Password",
"HTMLTemplate": "<input type=\"text\" value=\"\" maxlength=\"\" autocomplete=\"off\" name=\"\" id=\"\">"
}
}
},
dir = {
".field": {
"field <- Fields": {
"label": "field.FieldName",
"label@for": "field.FieldName",
"label+": function () {
console.log('Working');
return 'hi';
}
}
}
}
$('#test').render(data, dir);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment