2009-11-08 49 views
1

我在使用Scriptaculous的拖放庫讓我的div變得可排序時遇到問題。Scriptaculous的Sortables問題

<pre id="leftcol"> 
<div id="id0"><h3>Date and Time</h3><div class="moduleContent"></div></div> 
<div id="id14"><h3>Calculator</h3><div class="moduleContent"></div></div> 
</pre> 

<script type="text/javascript"> 
Sortable.create("leftcol", {tag:$$('div'), treeTag:$$('pre')}); 
</script> 

當我試着使用Safari瀏覽器的Web Inspector來調試,我得到以下錯誤: TypeError: Result of expression 'tagName.toUpperCase' [undefined] is not a function. dragdrop.js:932

是在dragdrop.js文件中的問題,或者是它在我的代碼,如果它在我的代碼,我該如何解決它?謝謝。

回答

3

Sortable.create方法要求的選項tagtagTree只是兩個字符串,而不是一個組DOM元素:

Sortable.create("leftcol", {tag:'div', treeTag:'pre'}); 

試試吧here