How AntWeb Checks Off All the Checkboxes

Figure 8-11 shows a stripped-down version of how AntWeb uses loops to check off all the checkboxes when a visitor clicks Select All.

I've taken out AntWeb's HTML formatting, along with the repetitive code for several of the counties, but the checkAll() function is exactly the same as AntWeb's. To see the complete AntWeb page in all its formatting glory, browse to http://www.bookofjavascript.com/Websites/AntWeb.

AntWeb's use of arrays and loops

Figure 8-11. AntWeb's use of arrays and loops

Line-by-Line Analysis of Figure 8-11

The first few lines in Figure 8-11 describe the form that contains the checkboxes. Line ❶ names the form bayAreaSearchForm ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.