【问题标题】:Jquery UI Droppable not working giving an error in Firefox and chrome?Jquery UI Droppable 无法在 Firefox 和 chrome 中出现错误?
【发布时间】:2012-02-03 12:17:40
【问题描述】:

我正在使用 Jquery Ui Draggable 和 droppable。 Draggable 工作正常,项目正在拖动,但由于某些原因,我没有让 droppable 工作。

如果我在 droppable 函数中提醒某些内容,则不会显示任何内容。

我正在使用 Jquery UI 1.6 和 jquery 1.3.2。

这是我正在使用的代码:

$(function() {
        $( "div.view-test-attributes .views-view-grid td" ).draggable({
                helper:'clone',
                cursor:'move'
            });
        $( "#ajaxCartUpdate" ).droppable({
            drop: function( e, ui ) {
                alert( "Dropped!" );
            }
        });
    });

当我在 ajaxCartUpdate div 中拖动 td 时,我在控制台上收到以下错误:

在 Firefox 中: F 未定义

在 Chrome 中: Uncaught TypeError: Cannot read property 'options' of undefined.

仅供参考,td 实际上正在 ajaxcartUpdate Div 中删除,但我没有收到警报。

【问题讨论】:

    标签: jquery jquery-ui jquery-ui-draggable jquery-ui-droppable


    【解决方案1】:

    每个选择器都需要逗号,在您的情况下,它是选择器中的“div.view-test-attributes,.views-view-grid,td”。请参见下面的示例。

    $(function() {
    
        $( "div.view-test-attributes,.views-view-grid,td" ).draggable({
                helper:'clone',
                cursor:'move'
            });
        $( "#ajaxCartUpdate" ).droppable({
            drop: function( e, ui ) {
                alert( "Dropped!" );
            }
        });
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-08
      • 1970-01-01
      • 1970-01-01
      • 2011-07-26
      相关资源
      最近更新 更多