How to make a toast, after clicking on button? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

How to make a toast, after clicking on button?

First hide toast, after clicking on button it will be show for 3 seconds, and it will be automatically hide after 3 seconds. https://code.sololearn.com/W1gr6yZtM4Qj/?ref=app

7th May 2023, 4:40 PM
𝐀𝐲𝐞𝐬𝐡𝐚 𝐍𝐨𝐨𝐫
𝐀𝐲𝐞𝐬𝐡𝐚 𝐍𝐨𝐨𝐫 - avatar
5 Answers
+ 5
https://code.sololearn.com/W224hE9ARaf4/?ref=app
7th May 2023, 4:59 PM
Calviղ
Calviղ - avatar
+ 3
Calviղ Pls avoid giving finished code as answer, because it makes the OP skip the most important part of learning. Prefer giving hints for the OP to find the solution instead.
8th May 2023, 4:44 AM
Emerson Prado
Emerson Prado - avatar
+ 1
note the <script> tags in aYeShA 's code. You need to use JavaScript (or php if you're a time traveler from 20 years ago) for this level of interactive content.
7th May 2023, 8:22 PM
Orin Cook
Orin Cook - avatar
+ 1
SWARUP MAHATO I assume you are trolling. Are you ok? You just posted a bunch of nonsense posts... maybe take a break from coding for a while. Anyway, it's html, javascript not xml, java and android. And there's no Runnable in your code that runs a timer and hides the Toast.
9th May 2023, 1:34 PM
Bob_Li
Bob_Li - avatar
0
aYeShA you could Google for the dialog element. Popups using this tag have .show() and .close() methods so you don't need to use the display:block or display:none workaround. But as in Calviղ 's code example, you still need a setTimeout to close it after the desired time period. I made a small codebit on how dialog might be used. I also included Calviղ 's fancy slidedown code. Explaining it is harder sometimes, so we provide examples. If there is anything you don't understand, ask and I am sure members here will be happy to explain it to you. https://code.sololearn.com/WWa5b6Xe29GA/?ref=app
9th May 2023, 8:03 AM
Bob_Li
Bob_Li - avatar