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—accessing values from a form

In the following example, we'll start off with a simple HTML form. You will learn about various techniques for accessing different form elements. What happens here is that you'll see how we first submit a form by using the onsubmit event. The onsubmit event allows us to send the form to a JavaScript function, which then helps us to extract the values from various form element types. So for this example, I need you to relax and understand the techniques mentioned earlier.

Note

The source code for this example is found in Chapter 2 of the source code folder, with a name of accessing-values-from-form.html.

  1. Once again, enter the following code into your newly-created document in your favorite editor:
    <html> ...

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