• One
  • Twoand then I: $("#selector...">

    JQuery UI draggable properties

    I have a list:

    <ul id="selector">
       <li id="1">One</li>
       <li id="2">Two</li>
    </ul>
    

    and then I:

    $("#selector li").draggable({
    revert: "valid"
    });
    $("#xyz tr").droppable({
    drop: function(event, ui) {
    console.log(ui.draggable.text());
    }
    });
    

    Q: How to determine if it was id = 1 or id = 2 that was deleted? The text property gives me One or Two, but I need 1 or 2.

    +3
    source share
    1 answer

    Use this method:

    ui.draggable.attr('id')
    
    +8
    source

    Source: https://habr.com/ru/post/1762029/


    All Articles