【问题标题】:Console does not show id when js updatejs更新时控制台不显示id
【发布时间】:2014-11-12 13:02:27
【问题描述】:

我有一个拖放功能。可拖动的 div 有一个 id,但是当我检查登录控制台时,它只是一个空行。为什么?

HTML:

<div id="1" class="ui-state-default">1</div>
<td><div id="sverige1_w1_mon" class="connectedSortable"></div></td>

JS:

$(document).ready(function() {
$( "#lista_objekt, #sverige1_w1_mon, #sverige2_w1_mon, #sverige3_w1_mon, #sverige4_w1_mon, #norge1_w1_mon, #norge2_w1_mon, #sverige1_w1_tu, #sverige2_w1_tue, #sverige3_w1_tue, #sverige4_w1_tue, #norge1_w1_tue, #norge2_w1_tue").sortable({
    connectWith: ".connectedSortable",
    placeholder: "ui-state-highlight",
    update: function(event, ui){
        var postData = $(this).sortable('serialize');
        console.log(postData);

        $.post('php/sortable_order.php', {list: postData}, function(o) {
            console.log(o);
        }, 'json');
    }
});
$( "#lista_objekt, #sverige1_w1_mon, #sverige2_w1_mon, #sverige3_w1_mon, #sverige4_w1_mon, #norge1w1_mon, #norge2_w1_mon, #sverige1_w1_tue, #sverige2_w1_tue, #sverige3_w1_tue, #sverige4_w1_tue, #norge1_w1_tue, #norge2_w1_tue").disableSelection();
});

【问题讨论】:

标签: jquery html jquery-ui-sortable


【解决方案1】:

id 必须包含下划线“_”

<div id="item_1" class="ui-state-default">1</div>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-07-16
    • 2018-02-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多