list dropdown with javascript

click the ▾ below to toggle list dropdowns.

copy and paste all this code wherever you want it to be, within the body tags.

by default, dropdowns do not show. to change this, in the ul tag's style, change "none" to "block"
multiple dropdowns can be done on one page, but id and function must be different for each. in the above example, id's are "FRUIT" and "VEG", and functions are "toggleVeg" and "toggleFruit"
i used ▾ (downward pointing triangle) as my dropdown togglers, but anything can be used with 'onclick="toggleVeg()"' in the tag around it.

download text file

return