Form Basics

Figure 7-4 shows a simple form displayed in a browser, and Figure 7-5 shows the HTML behind that form.

A simple HTML form

Figure 7-4. A simple HTML form

HTML code for the basic form shown in

Figure 7-5. HTML code for the basic form shown in Figure 7-4

Text Fields

As you can see in Figure 7-4, the HTML in Figure 7-5 draws two text boxes on the screen. A visitor to your site can click inside the text boxes and type a name and age.

Notice that the form is constructed of normal HTML. Like most HTML, the form must go between the <body> and </body> tags. The form begins with a <form> tag and ends with ...

Get The Book of JavaScript, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.