From the course: JavaScript: Web Form Programming

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Automatic shortcut keys

Automatic shortcut keys

From the course: JavaScript: Web Form Programming

Start my 1-month free trial

Automatic shortcut keys

- [Instructor] In the previous example, we saw how to make our forms accessible via the keyboard by using the access key attribute. So in this video, we're going to see how we can automate the process of giving the user a visual indicator that a form field has an access key. So let's resume by looking at our code. So if we scroll up to the top, you will see that I have some JavaScript functions here in the code named add access key hints, and add key hint. And these are the functions that we're going to fill in. So the add access key hints function runs when the window loads. It starts off by getting the form element. And then it iterates over all of the elements of the types that are in this array. So all the labels, all the links and all the buttons. And for each one of those elements, we get a list of all the elements of that type. And then we check to see if each of those elements has an access key attribute, and if it…

Contents