I have a Class names dialog. Inside this class I have a method hide() to hide the dialog box itself and its modal box. But I can't access hide function from "onclick" function. How can I access it?
class Dialog{
constructor(id){
this._dialogBox = $('.dialog#'+this.id);
this._closeButton = this._dialogBox.find('span.closedialog');
this._closeButton.on('click', function(){
//how to access hide() function from here?
});
}
hide(){
this._dialogBack.hide();
this.dialogBox.hide();
}
}
span.closedialogto be changed tobutton.closedialog(In HTML). This improves HTML semantics and brings significant benefits to usability and accessibility. Try to focus SPAN using only a keyboard TAB key... All this comes for free if using the proper semantics