You would need to get the form element (e.g. assign it an id <form method="dialog" id="myForm">
, get a reference to it in your code (document.getElementById('myForm')
) and then, you could use this code. I’d also suggest returning a new Promise
which you manually resolve when onsubmit()
gets called instead of showModal()
– this allows you to get all your code in there (you could – for example – resolve this with an object containing options a user has selected and use the result you await
elsewhere to do what your plugin should do).
1 Like