Project Activity 3: JavaScript Basics
Project Activity 3: JavaScript Basics
Interactive Button Click
Create a simple HTML page with a button element and a <p> element. Use JavaScript to add interactivity to the page such that when the button is clicked, the text in the <p> element changes to a different message.
Here’s a basic outline to get you started:
- Create an HTML file with the necessary structure, including a button element and a <p> element.
- Add an event listener to the button element in your JavaScript code.
- Inside the event listener function, change the text content of the <p> element to a different message using the textContent property.
- Test your project by opening the HTML file in a web browser and clicking the button to see the text change in the <p> element.
Feel free to customize the button style and messages to make it more engaging. Have fun experimenting with different text changes and exploring other JavaScript events and properties to enhance the interactivity of your project.