staticMethod
HTML
<div id="tests></div>
JavaScript
class TestsPage {
constructor(){
this.count = 0;
}
addTest(name, fun) {
var div = this.createDiv(this.count++, name);
div.bind("click", fun);
}
createDiv(id, text) {
var tests = $('#tests');
var div = $('<div></div>');
div.attr('id', id);
div.html(text);
div.addClass('testButton');
div.appendTo(tests);
var br = $('<br />');
br.appendTo(tests);
return div;
}
}
function run(){
alert("HI");
}
var testpage = new TestsPage();
testpage.addTest("test1", run);