我想阻止用户选择超过5个选项,但我还没有找到解决方案。有人能帮我吗?这是我的密码
student_html += '<select name="course_titles'+x+'[]" id="example" class="form-control mymultiple" multiple="multiple">';
student_html += strCourse;
student_html += '</select>';发布于 2021-06-27 13:23:17
有两种可能的行为:
这里有两种不同的情况: bsmultiselect在select上(结果将形成),或者在JS对象上。
在第一种情况下,使用“自定义Html ValidationAPI”multiSelect.validationApi.setCustomValidity(...);
在第二种情况下,使用“自定义引导验证”(通过配置{getValidity: fuction( return true; //or false ) } )
中选择第6位
本例通过配置传递setSelected,如果要取消第6个元素选择,则返回false
{
setSelected(){
if (getSelectedCount(options) ==5) // write it getSelectedCount, just loop through your data or query bsMultiSelect.picksCount;
return false;
}
}https://stackoverflow.com/questions/67227419
复制相似问题