0
Text with functionality.
Let's say we have a button that writes "Hello!" everytime you press it, and every 3 times you press it the "hello" that pops up is clickable and when you click it, it alerts "Hello world!". How would you do that?
4 Respostas
0
My solution as described above would look like this:
https://code.sololearn.com/Wmz1CNx8r2Pp/?ref=app
+ 2
Create a event listener on a button for a "click" event. The function included will create a new html element with innerHTML = "Hello!"; when the event is fired. Every third time you add a further event listener on the new html element you created, that will alert "Hello world!".
Hope that made sense. If not you can ask me :)
+ 1
Thanks a lot! :)
0
Aaron Eberhardt Could you show me an example code of how would it be? I'm a little confused about what you said.