How do you limit options selected in a html select box?

后端 未结 8 833
一生所求
一生所求 2020-11-27 19:07

I\'m using a select tag in a form I\'m making that allows multiple selections, but I want to make the maximum amount of selections upto 10. Is this possible using javascript

8条回答
  •  余生分开走
    2020-11-27 19:38

    Here is some full code for you to use...gotta love the Google AJAX API Playground :-)

    Edit 1: Note: this only lets you choose 5 because I didn't feel like copy/pasting another 10 options :-)

    
    
    
    
      
        
        Sample Select Maximum with jQuery
        
        
      
      
        
      
    
    

    Demo

提交回复
热议问题