在第一次选择单个项目时自动从多选中取消选择

时间:2013-04-30 20:42:18

标签: jquery-ui

我有一个选项列表,在select中设置为多选。第一个是自动选择的,但我希望在选择任何其他选项后立即取消选择。

我的尝试在下面并注释掉,因为任何时候我取消注释任何一行,页面都没有正确生成,并且框甚至没有显示,我得到的只是列表。

当我检查日志时,我看到'未捕获的ReferenceError:deselect_all未定义'。

<select multiple class="leftmulti multiselect" name="category[]" id="category[]">
<option value="all" selected>Full List</option>
<option value="Human Resources">Human Resources</option>
<option value="Finance & Accounting">Finance & Accounting</option>
<option value="Legal">Legal</option>
<option value="Administrative Support">Administrative Support</option>
<option value="Brand Management">Brand Management</option>
<option value="Audit & Corporate Compliance">Audit & Corporate Compliance</option>
<option value="Creative Services & Support">Creative Services & Support</option>
<option value="Customer Service">Customer Service</option>
<option value="Design - Graphic & Web">Design - Graphic & Web</option>
<option value="Design - Product">Design - Product</option>
<option value="Distribution Center">Distribution Center</option>
<option value="Facilities & Maintenance">Facilities & Maintenance</option>
<option value="Field Merchandising">Field Merchandising</option>
<option value="Global Operations & Supply Chain">Global Operations & Supply Chain</option>
<option value="Information Technology">Information Technology</option>
<option value="Internships">Internships</option>
<option value="Loss Prevention">Loss Prevention</option>
<option value="Marketing & Public Relations">Marketing & Public Relations</option>
<option value="Merchandising">Merchandising</option>
<option value="Planning & Allocation">Planning & Allocation</option>
<option value="Product Development">Product Development</option>
<option value="Real Estate & Construction">Real Estate & Construction</option>
<option value="Retail Sales">Retail Sales</option>
<option value="Retail Store Management">Retail Store Management</option>
<option value="Sales & Account Management">Sales & Account Management</option>
<option value="Store Operations">Store Operations</option>
<option value="Training & Communications">Training & Communications</option>
<option value="Visual Merchandising<">Visual Merchandising</option>
</select>



<script type="text/javascript">
        jQuery(function(){
                jQuery(".multiselect").multiselect({});
                jQuery(".multiselect").multiselect(deselect_all);
        });
</script>

0 个答案:

没有答案