var Test = function(data){
this.data = data
}
Test.prototype = {
initHtml: function(){
var html = '<p class="test">'+ this.data +'</p>'
return html
},
create: function(){
$('body').append(this.initHtml())
this.initEvent()
}
}
There are many similar constructors Test1, Test2...
on the pageGenerate content in the page through new Test1('I am the content'), new Test2('I am the content')
Could you please tell me how to modify the constructor or other methods so that when new Test1 ('other content') is used, the content generated in the page by new Test1 ('I am the content') will be correspondingly modified
Single case mode? ? ?