I am very new to this and it is reflected on the way i put the title.
May be the example below can illustrate my question better.
I have a an object called model.
var Modal = new function(){
this.id = 'modal_id';
this.title = 'Modal title';
this.content = 'Modal content';
this.display = function(){
return '<div class="popup">' + this.title + ' ' + this.content + '<br><button id="button"></div>';
};
}
The object is called with this for example:
Modal.title = 'My New title';
Modal.content = 'My New content';
Modal.display();
But let's say i want to have an event for the button the trigger different action, how can i define the function when calling the object when button is clicked?
$('#button').on('click', function(){
// different action here
});