我有一个在选择中设置为多选的选项列表。第一个是自动选择的,但我希望在选择任何其他选项后立即取消选择它。
我的尝试在下方,并在我取消注释任何行时注释掉,页面无法正确生成,框甚至没有显示,我得到的只是列表。
当我检查日志时,我看到“未捕获的 ReferenceError: deselect_all is not defined”。
<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>