Created
February 4, 2013 22:56
-
-
Save gonzaloruizdevilla/4710525 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var moduleD = function () { | |
return { | |
data: dataArray, | |
init: function () { | |
this.addTable(); | |
this.addEvents(); | |
}, | |
addTable: function () { | |
var td, tr; | |
var frag = document.createDocumentFragment(); | |
var frag2 = document.createDocumentFragment(); | |
for (var i = 0; i < rows; i++) { | |
tr = document.createElement('tr'); | |
for (var j = 0; j < this.data.length; j++) { | |
td = document.createElement('td'); | |
td.appendChild(document.createTextNode(this.data[j])); | |
frag2.appendChild(td); | |
} | |
tr.appendChild(frag2); | |
frag.appendChild(tr); | |
} | |
tbody.appendChild(frag); | |
}, | |
addEvents: function () { | |
$('table').on('click', 'td', function () { | |
$(this).toggleClass('active'); | |
}); | |
} | |
}; | |
}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment