0

ドロップ可能にドロップされた後、divにパラメーターを追加しようとしています。パラメータを追加できる以下のaddParameterに似たメソッドはありますか?

    $( ".placeHolder" ).droppable({ drop: function( event, ui ) 
            { 
       "#"+this.id.addParameter(myParam="testParam");
}
4

2 に答える 2

1

関数を使用し.attr()ます。属性を設定するには、

$(this).attr('my_attribute', 'my_value');

そしてそれを使用するために

$(this).attr('my_attribute');
于 2012-05-25T14:53:24.020 に答える
0

If you mean setting the attribute to the draggable element, then you can use:

$(".placeHolder").droppable({
    drop: function(event, ui) {
        ui.draggable.attr("myParam", "testParam");
    }
});

Otherwise, just use ui.draggable as a jQuery object of the draggable element.

于 2012-05-25T14:52:53.753 に答える