What should you know before reading this guide?
Need a place to host your website? Get your first month of HostGator web hosting for only 1 cent (or save up to 60%). Visit the previous link for the latest deals (updated daily).
- The HTML <script> tag
- Accessing HTML elements
- Handling events
- Changing CSS properties
- if statements and conditional logic
- Arrays (lists)
- Loops (while, for, do while, break, continue)
- Let's create a mini quiz
- AJAX - Send or receive data (without reloading the page)
- Using relational properties to access elements
- DOMContentLoaded event and Anonymous functions
Showing an alert when a button is pressed
Take a look at the code below, and see if you can figure out how it's working to display the alert. If it doesn't make sense, don't worry. In the next sections, we'll explain this code in detail.
The HTML <script> tag