2013-05-28 43 views
1

我使用jQuery插件中發現的1.4版本(DDCL)DropDownCheckList不工作​​

here而在我的本地機器上保存它,闖民宅它從本地我的HTML代碼,並且還我使用的版本的jQuery 1.7.1。我想創建我的頁面加載下拉清單,但它沒有正確地發生,任何人都可以建議我哪裏出錯,我做錯了什麼,這裏是我的代碼片段,

<!DOCTYPE html> 
<html> 
<head> 
<script src="C:/Users/local/Desktop/jquery-1.7.1.js" type="text/javascript"> 
</script> 
<script src="C:/Users/local/Desktop/ui.dropdownchecklist.js" type="text/javascript"></script> 
</head> 
<body> 

<select multiple id="s2"> 
<option value="volvo">Volvo</option> 
<option value="saab">Saab</option> 
<option value="fiat">Fiat</option> 
<option value="audi">Audi</option> 
</select> 

<script type="text/javascript"> 
$(document).ready(function() {   
$("#s2").dropdownchecklist(); 
}); 
</script> 
</body> 
</html> 
+0

該鏈接似乎不工作 –

+0

對不起,該鏈接是http://dropdown-check-list.googlecode.com/svn/trunk/doc/dropdownchecklist.html – joedanny

回答

0

[未測試]

T RY預謀的 「file://本地主機/」 給你的路:

<script src="file://localhost/C:/Users/local/Desktop/jquery-1.7.1.js"></script> 
<script src="file://localhost/C:/Users/local/Desktop/ui.dropdownchecklist.js"></script> 

你應該能夠離開了主機部分(本地主機)這樣的(注意三個斜槓):

<script src="file:///C:/Users/local/Desktop/jquery-1.7.1.js"></script> 
<script src="file:///C:/Users/local/Desktop/ui.dropdownchecklist.js"></script> 
0

我有同樣的問題,並發現這個問題。

在ui.dropdownchecklist.js

,在函數的末尾 「_syncSelected:功能(senderCheckbox)」

使最後的循環(allCheckboxes.each(函數(指數){)是這樣的:

allCheckboxes.each(function(index) { 
     if ($(this).attr("checked") == "checked") 
      $(selectOptions[index]).attr("selected", "selected"); 
     else 
      $(selectOptions[index]).removeAttr("selected"); 
    });