Vulpeculox home page Miscellany menu
Javascript
Picklist for convenient user interaction code

Description and API

PICKLIST is a small Javascript class that encapsulates a mapping between strings and constants. Typically used for drop-down lists, checkboxes and radio button controls. Simple and flexible to use: One or two array constructor, generate HTML method, look-up string from index or index from string methods.

Example

Setup var DIR_N = 0; var DIR_E = 90; var DIR_S = 180; var DIR_W = 270; var directionsList = new PICKLIST(['North','East','South','West'],[DIR_N,DIR_E,DIR_S,DIR_W]); Display var htmlToShow = directionsList.ChecksHtml([['West',90'],'directions','<br>');

Show API

Demonstrate and exercise

Show demo

Get started

  • Notes
  • testpicklist.js is included in the download package as an example of usage. It won't work straight out of the box as it needs jQuery and styling.

Testing

Run tests Red results indicate failed tests. Error messages are often the correct response.

Constructor

Lookups