Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- function checkboxlimit(checkgroup, limit){
- for (var i=0; i<checkgroup.length; i++){
- checkgroup[i].onclick=function(){
- var checkedcount=0
- for (var i=0; i<checkgroup.length; i++)
- checkedcount+=(checkgroup[i].checked)? 1 : 0
- if (checkedcount>limit){
- alert("You can select a maximum of "+limit+" boxes.")
- this.checked=false
- }
- }
- }
- }
- checkboxlimit(document.forms.name-of-your-form['field-name[]'], 5);
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement