Micromodal
Micromodal copied to clipboard
Is there any way to pass custom parameter on MicroModal.show ?
Hello !
I would like to pass some custom parameters when I open a Modal.
/**
* Kick player from team with id
* @param {MouseEvent} event
*/
function kickPlayer(event) {
const id = event instanceof MouseEvent ? +event.target.dataset.id : null
if (id) {
MicroModal.show('modal-kickPlayer', {
"custom-parameter": id
})
}
}
const kickButtons = document.querySelectorAll('button.custom_kickPlayer');
if (kickButtons) {
Array.from(kickButtons).forEach(item => {
item.addEventListener('click', kickPlayer);
})
}
Is it possible ? Thank you very much. I hope the question hasn't already been asked.