【发布时间】:2020-12-24 18:14:10
【问题描述】:
我的 select2 下拉菜单显示不正确。
以下是代码:
//这里包含select2 CSS文件 HTML 代码:
<div>
<tr>
<td><b><bean:message key="label.student.display" />:</b>
<html:select property="stuCode" styleId="rollno" onchange="getStuData(this);">
<html:option value=""><bean:message key="label.student.select" /></html:option>
<html:option value="ABC">ABC</html:option>
<html:option value="XYZ">XYZ</html:option>
<html:optionsCollection name="studentForm" property="StuList" label="label" value="value" />
</html:select>
</td>
</tr>
</div>
//included javascript select2 tag
</body>
JQuery 代码:
$(function() {
$("#rollno").select2();
});
Select2 被包含在控制台中,没有任何错误。但输出不如预期。
请注意:HTML 页面中有多个表单。某些表单使用普通下拉菜单而不是 Select2。请帮我解决这个问题。提前致谢!
【问题讨论】:
标签: javascript jquery dropdown jquery-select2