O'Reilly logo

JavaScript Testing by Liang Yuxian Eugene

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action—avoiding HTML event handlers

In this section, you will learn how to avoid HTML event handlers by coding in a different style. In this case, we will not only remove the JavaScript events embedded in each of the HTML input elements, we will also need to write new functions for our JavaScript application in order for it to work in the same manner. In addition to that, we will be using a JavaScript library that will help us to remove all of the difficult stuff relating to event handling and using event listeners.

  1. Open up the same document and scroll to the<body> tags. Remove all of the HTML event handlers that are found in the form. This is what your form's source code should look like after you have removed all of the HTML event handlers: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required