Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/chridpkm/chrisrios.com/wp-includes/functions.php on line 6114
code Archives - Christian Rios' Blog

Limit the number of items the user can select in a ListBox with JQuery

This little script is able to grab all the listboxes on the page.

      $(document).ready(function() {
          $("select").change(function() {
             if ($(this).find('option:selected').length > 5) {
               this.options[this.selectedIndex].selected = false;
             }; }); }); 

pretty sleek huh?