How the Doctors Without Borders Pull-Down Navigation Tool Works
The Doctors Without Borders pull-down navigation code is very similar to the JavaScript you saw in Figure 7-27. Figure 7-28 shows you their code, modified to save space:
Figure 7-28. Code for the Doctors Without Borders pull-down navigation tool
The only big difference between the code in Figure 7-27 and the Doctors Without Borders code in Figure 7-28 is the if-then
clause starting in ❶. This extra test is necessary because the first option
in their pull-down contains no value—it's just a header. If a visitor selects an option
with no value, the value
property of the select
is set to ...
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.