The alerts do not disappear

  • Hello everyone, I am launching alerts from JavaScript depending on the response from a server to which I make a request, as each response I throw a different alert and I need this alert to only spend some time on the air and then disappear.

    As I read in the documentation there is the property duration, but I use it and when testing the alert it remains there only until I close it, but it is not exactly what I need.

    I create the alerts as follows:

    I would expect that after the alert appeared, it would remain on the screen for five seconds and then disappear, but this does not happen.

    Thanks for reading, I hope someone can help me

  • Hello!

    Per the docs, duration determines the time it takes to transition, not how long the alert should stay open. Either use setTimeout() or use Toast

  • I solved this using the setTimeout method as you recommend me in the following way.


    It works in the following way

    Gif in imgur

    Thanks, I think this could be in the documentation. no matter how simple it is, it would help more than one.

Log in to reply