Skip to content

Instantly share code, notes, and snippets.

@gonzaloruizdevilla
Last active December 12, 2015 03:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gonzaloruizdevilla/4710409 to your computer and use it in GitHub Desktop.
Save gonzaloruizdevilla/4710409 to your computer and use it in GitHub Desktop.
var moduleA = function () {
return {
data: dataArrayObject,
init: function () {
this.addTable();
this.addEvents();
},
addTable: function () {
for (var i = 0; i < rows; i++) {
$tr = $('<tr></tr>');
for (var j = 0; j < this.data.length; j++) {
$tr.append('<td>' + this.data[j]['id'] + '</td>');
}
$tr.appendTo($tbody);
}
},
addEvents: function () {
$('table td').on('click', function () {
$(this).toggleClass('active');
});
}
};
}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment