jq获取多选框选中个数做限制

var num=4;

$(".xuan").change(function(){

       var _this=$(this);

       if($('.xuan:checked').length>num){

             if(_this.is(":checked")){

                   _this[0].checked=false;

                   alert("最多只能选择四支球队进行投票");

              }

        }

 })

二手闲置小程序 免费信息发布系统功能源码(小程序+php后台管理)

https://blog.csdn.net/MPQ1314/article/details/87162363

电商商城小程序 小程序+php后台管理系统功能源码

https://blog.csdn.net/MPQ1314/article/details/103723983

发布了40 篇原创文章 · 获赞 22 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/MPQ1314/article/details/86702301
今日推荐