ivaynberg/select2 — pull request #274 by kevin-brown (2012-07-27 12:04:43+00:00)
Title: Fixes #59: Limited Selection

This adds support for limiting the number of options that can be selected, as suggested in #59. This _also_ fixes a small bug when joining the data for the parent element to set values where the separator set in the options was not used.

This introduces two new settings, `selectionLimit` (int) and `formatLimitReached(limit)` (fn) that can be used to limit the number of options that can be selected in a multi-select element. Once the limit is reached, a message is displayed using `formatLimitReached` instead of displaying the options.

The default for `selectionLimit` is **0**, which means that it will not check for a limit.