JSFiddle - React, Tailwind, and code Playground
HTML
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<table id="peopleWrapper" border="1"></table>
<script type="text/template" id="tpl-person">
<tr >
<td><%=name%></td>
<td><%=age%></td>
<td><button onclick="this.happyBirthday()">Birthday</button></td>
</tr>
</script>
JavaScript
var people = {};
var Person = function(name, age){
this.changeName = function(newName){
this.name = newName;
};
this.happyBirthday = function(){
this.age ++;
alert(this.age);
}
this.render = function(){
var template = _.template($("#tpl-person").html());
$("#peopleWrapper").append(template(this));
}
//constructor
this.name = name;
this.age = age;
this.render();
}
$(function(){
people.philippe = new Person("Philippe", "22");
people.nick = new Person("Nick", "33");
people.luc = new Person("Luc", "54");
});