marcelodolza / iziToast

Elegant, responsive, flexible and lightweight notification plugin with no dependencies.
https://marcelodolza.github.io/iziToast/
Apache License 2.0
2.62k stars 306 forks source link

Dynamic message #200

Closed AndrewPixel closed 3 years ago

AndrewPixel commented 3 years ago

I have a toast that is displayed for a relatively long time so I'd liked to periodically change the message. After the toast is displayed. I tried this:

let iziTxt = document.querySelector('.iziToast-message.slideIn');
iziTxt.innerHTML = "Still working...";

but the message didn't change. How can I change the message dynamically?

serious-angel commented 3 years ago

How do you create a toast? Do you store toasts as objects in some array?

AndrewPixel commented 3 years ago

Sorry, after checking it numerous times I found that the toast I created and subsequently destroyed before displaying the current toast was being referenced. I added an ID to the current toast and I was able to reference (and change) the message correctly.