Solution: Create a Button That Talks
This code displays different messages when two buttons are clicked — one says hello and the other says goodbye.
Explanation:
When the “Click Me” button is pressed, the paragraph with ID
"response"changes to show “👋 Hello there!” in green text.When the “Say Bye” button is pressed, the paragraph with ID
"response2"updates to show “Goodbye! 👋”.Together, it demonstrates how event listeners can be used to make a webpage respond dynamically to user actions.
Solution: Create a Button That Talks
This code displays different messages when two buttons are clicked — one says hello and the other says goodbye.
Explanation:
When the “Click Me” button is pressed, the paragraph with ID
"response"changes to show “👋 Hello there!” in green text.When the “Say Bye” button is pressed, the paragraph with ID
"response2"updates to show “Goodbye! 👋”.Together, it demonstrates how event listeners can be used to make a webpage respond dynamically to user actions.