From the course: JavaScript for Web Designers
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Disabling and enabling fields - JavaScript Tutorial
From the course: JavaScript for Web Designers
Disabling and enabling fields
- [Instructor] We're going to take things up a notch now. Still enforcing the same requirement that the state field be filled in, but our approach will be more forceful. We're going to disable the estimate total button when the page loads and enable it again, once the selection is made. To do this, we're going to listen to a different event. An event called dom content loaded. We're going to listen for this on the document itself. So, we're going to call document dot add add event listener, and the event we're going to listen for is dom content loaded. This is the event that's called when the page is loaded sufficiently that the dom is ready for us. The images might not have loaded. If we want that, we'd generally be using the load event, but dom content loaded is what we can listen for when we just want to make sure that our form element are ready for us to start adding event listeners to them and so forth. And for…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Working with user info4m 44s
-
Text fields and select boxes5m 45s
-
(Locked)
Radio buttons and checkboxes5m 30s
-
(Locked)
Changing submission with events4m 21s
-
(Locked)
Starting to validate input4m 15s
-
(Locked)
Disabling and enabling fields5m 14s
-
(Locked)
The basics of sanitizing user input7m 1s
-
(Locked)
Get and set with innerHTML6m 58s
-
(Locked)
Challenge: Add and use more fields56s
-
(Locked)
Solution: Add and use more fields3m 23s
-
(Locked)
-
-
-
-