How can I close a form in a popUp?

I am using Engagebox and want to close the engagebox after a submit?

I will like to use Javascript code within your popup, like:

EngageBox.onReady(function() {
const form = document.querySelector('#cf_MyFormID');
form.addEventListener('success', function() {
const box = EngageBox.getInstance({});

But I dont now querySelector or addEventListener I can use.
What to use?

Replies are visible only to logged in members with an active subscription.