转换器助手ID

时间:2011-03-21 14:54:35

标签: jquery jquery-ui draggable helper

我想更改帮助器,如果它不起作用

$('.column1').draggable({
containment: '#sort' , 
helper:'clone',
connectToSortable:'#sort',
start: function(event,ui) {
            i=counts[ 0 ]++;
            document.getElementById('wid').value=i;
            updateCounterStatus( $start_counter, counts[ 0 ] );
            ui.helper.attr("id","colum2");


        }

4 个答案:

答案 0 :(得分:0)

查看jQuery UI文档,这应该有用......你怎么知道它不起作用?我建议的是尝试将ui.helper.attr("id", "colum2");更改为$(ui.helper).attr("id", "colum2");

答案 1 :(得分:0)

帮助程序ID只能是“原始”或“克隆”。如果你改变它,它将停止工作。

你到底想要完成什么?

答案 2 :(得分:0)

一个jQuery可拖动助手有一个类'ui-draggable-dragging'。试试这个:

start: function(event,ui) {
    i=counts[ 0 ]++;
    document.getElementById('wid').value=i;
    updateCounterStatus( $start_counter, counts[ 0 ] );
    $('.ui-draggable-dragging').attr("id","colum2");
}

答案 3 :(得分:0)

我感谢您的回答

解决方案:

$('#colum').draggable({

helper:'clone',
connectToSortable:'#sort',
start: function(event,ui) {
            k=counts[ 0 ]++;
            document.getElementById('wid').value=i;
            updateCounterStatus( $start_counter, counts[ 0 ] );
             $(this).attr("id","colum"+k);



        }
相关问题