How to show modal window in custom plugin

Hi! I want to create my custom plugin. There are several buttons in the interface of my plugin. I want to show a modal window when these buttons are pressed. How can I do this? I’ve tried to do this, but it doesn’t work. When I pass my function to the “onclick” of the button, I get the error “openModal is not defined”

let variation = {
	url: 'modal.html',
	description: window.Asc.plugin.tr('Warning'),
	isVisual: true,
	isModal: true,
	EditorsSupport: ['word'],
	size: [350, 100],
	buttons: [
		{
			'text': window.Asc.plugin.tr('Yes'),
			'primary': true
		},
		{
			'text': window.Asc.plugin.tr('No'),
			'primary': false
		}
	]
};


(function (window, undefined) {

	window.Asc.plugin.init = function (text) {

		...skiped...
	};

	...skiped...

	function openModal() {
		window.Asc.plugin.executeMethod("ShowWindow", ["iframe_asc.{584EEEE8-DBF5-45C3-A4CA-F52177C82754}", variation]);
	}

})(window, undefined);

Hello @giome3c
Could you please provide us with entire plugin? We will take a closer look at it.

Ok)

Thank you, we are checking the situation.

1 Like

Hello @giome3c
Sorry for the late reply.
Probably you can achieve it this way:
< input id="open" value="Click Me!" type="button" >

window.Asc.plugin.init = function()
{
document.getElementById('open').addEventListener('click', function (){
    window.Asc.plugin.executeMethod ("ShowWindow", ["iframe_asc.{BE5CBF95-C0AD-4842-B157-AC40FEDD9841}", variation]);
})
...

Please clarify if it matches your needs.