Closed xiranst closed 6 years ago
I'm not sure what you mean. Do you mean putting an iframe
inside of the dialog? Do you mean putting an HTML partial or view inside of the dialog and then closing the dialog programmatically?
@bbatliner thanks for you reply. not iframe. i have solve my question. i want to add click or other event into the open window. i added the click event code in afterOpen function and can work for me. do you have another method to do it?
If you want to add a click event to the vex dialog itself, then this has to be done in afterOpen
, as you've done, because the elements don't exist until after the call to open
.
If you want to add events to your content that you are showing in the dialog, you can do this before opening the dialog.
Here's an example:
var myContent = document.createElement('div')
var myButton = document.createElement('button')
myButton.textContent = 'Click me'
myButton.addEventListener('click', (e) => {
e.preventDefault()
console.log('clicked')
})
myContent.appendChild(myButton)
vex.dialog.open({ unsafeMessage: myContent })
@bbatliner thanks for your reply. i will try it later. could you check my another issue? https://github.com/HubSpot/vex/issues/240 . in the vex open, i have init the tinymce and it is working, but the textarea can not get the data of tinymce. so the form is not submitted.
i used vex.dialog.open a html page, how to click some elements in the same windows and then close it?