How to get dropped div name jquery drag and drop











up vote
0
down vote

favorite












This is continuation of my question first question



Here i am drag and drop sticky notes from one to another. i have



 <div class="rTable">
<div class="rTableRow">
<div id="a" title="Backog" class="rTableHead rTabletd"><strong>Backlog</strong></div>
<div id="a" title="WIP" class="rTableHead rTabletd"><span style="font-weight: bold;">WIP</span></div>
<div id="a" title="Testing" class="rTableHead rTabletd">Testing</div>
<div id="a" title="DOD" class="rTableHead rTabletd">DOD</div>
</div>
<div class="rTableRow rTableh" >
<div class="rTableCell"></div>
<div class="rTableCell"><a></a></div>
<div class="rTableCell"></div>
<div class="rTableCell"></div>
</div>

</div>


and sticky notes



<?php


foreach ($this->getallstores as $stories):

?>

<div id="draggable-<?php echo $stories['id']; ?>" class="draggable " onchange="javascript:position(this)" style="position:absolute; left: <?php echo $stories['_left']; ?>px; top: <?php echo $stories['_top']; ?>px">
<img class="pin" src="/manage/public/img/pin.png" alt="pin" />

<blockquote class="quote-box note-<?php echo $stories['color']; ?>">

<p class="quote-text" id="content-<?php echo $stories['id'];?>">
<?php echo $stories['message']; ?>
</p>
<hr>
<div class="blog-post-actions">
<p>
<button class="btn btn-primary popEdit pull-left" data-toggle='tooltip' title="Edit" onClick="popOverEdit(<?php echo $stories['id'];?>)" id="pop-<?php echo $stories['id'];?>"><span class="glyphicon glyphicon-edit"></span></button>
<div class="popover-markup blog-post-bottom" >

<div class="head hide">Edit</div>
<div class="content hide" id="popoverContent<?php echo $stories['id'];?>">
<div class="form-group">
<textarea id="<?php echo $stories['id']; ?>" class="quick" ><?php echo $stories['message']; ?></textarea>
</div>
<button data-vendor-id="" data-act="send" onClick="getText(<?php echo $stories['id'];?>)" class="btn btn-info save_notes">Save</button>
</div>
</div>
</p>
<p class="blog-post-bottom pull-right">
<a class="delete" href="?delete=<?php echo $stories['id']; ?>" style="float:right"> <button class="btn btn-danger" title="delete"><span class="glyphicon glyphicon-trash"></span></button> </a>
</p>
</div>
</blockquote>

</div>

<?php endforeach;?>


demo
enter image description here



my requirement is i want to drag and drop stickys and save to database.Now i have save position.is there any way to save column name?eg if drag sticky note from backlog to testing how can i get placed position name is testing?Please help me.



jquery



jQuery(function() {


jQuery( ".draggable" ).draggable({ containment: "#containment-wrapper", scroll: false ,

// Find position where image is dropped.
stop: function(event, ui) {

// Show dropped position.
var id=$(this).attr('id');
var ti=$(".rTabletd").attr("title");
var Stoppos = $(this).position();
model = {
id:id,
left: Stoppos.left,
top: Stoppos.top
};


$.ajax({
url: "/scrum/save",
type: "post",
data: model,
success: function(data){

jQuery.HP({
title: "Success!",
message: "Saved..."
});
},
error:function(){
// alert('error is saving');
}
});



}
});



});









share|improve this question






















  • Store the Id of the parent's div as well. So make sure an element's id is unique like it's supposed to.
    – dn Fer
    Nov 7 at 6:14










  • @dnFer can you please help me.please
    – Ezra
    Nov 7 at 6:19















up vote
0
down vote

favorite












This is continuation of my question first question



Here i am drag and drop sticky notes from one to another. i have



 <div class="rTable">
<div class="rTableRow">
<div id="a" title="Backog" class="rTableHead rTabletd"><strong>Backlog</strong></div>
<div id="a" title="WIP" class="rTableHead rTabletd"><span style="font-weight: bold;">WIP</span></div>
<div id="a" title="Testing" class="rTableHead rTabletd">Testing</div>
<div id="a" title="DOD" class="rTableHead rTabletd">DOD</div>
</div>
<div class="rTableRow rTableh" >
<div class="rTableCell"></div>
<div class="rTableCell"><a></a></div>
<div class="rTableCell"></div>
<div class="rTableCell"></div>
</div>

</div>


and sticky notes



<?php


foreach ($this->getallstores as $stories):

?>

<div id="draggable-<?php echo $stories['id']; ?>" class="draggable " onchange="javascript:position(this)" style="position:absolute; left: <?php echo $stories['_left']; ?>px; top: <?php echo $stories['_top']; ?>px">
<img class="pin" src="/manage/public/img/pin.png" alt="pin" />

<blockquote class="quote-box note-<?php echo $stories['color']; ?>">

<p class="quote-text" id="content-<?php echo $stories['id'];?>">
<?php echo $stories['message']; ?>
</p>
<hr>
<div class="blog-post-actions">
<p>
<button class="btn btn-primary popEdit pull-left" data-toggle='tooltip' title="Edit" onClick="popOverEdit(<?php echo $stories['id'];?>)" id="pop-<?php echo $stories['id'];?>"><span class="glyphicon glyphicon-edit"></span></button>
<div class="popover-markup blog-post-bottom" >

<div class="head hide">Edit</div>
<div class="content hide" id="popoverContent<?php echo $stories['id'];?>">
<div class="form-group">
<textarea id="<?php echo $stories['id']; ?>" class="quick" ><?php echo $stories['message']; ?></textarea>
</div>
<button data-vendor-id="" data-act="send" onClick="getText(<?php echo $stories['id'];?>)" class="btn btn-info save_notes">Save</button>
</div>
</div>
</p>
<p class="blog-post-bottom pull-right">
<a class="delete" href="?delete=<?php echo $stories['id']; ?>" style="float:right"> <button class="btn btn-danger" title="delete"><span class="glyphicon glyphicon-trash"></span></button> </a>
</p>
</div>
</blockquote>

</div>

<?php endforeach;?>


demo
enter image description here



my requirement is i want to drag and drop stickys and save to database.Now i have save position.is there any way to save column name?eg if drag sticky note from backlog to testing how can i get placed position name is testing?Please help me.



jquery



jQuery(function() {


jQuery( ".draggable" ).draggable({ containment: "#containment-wrapper", scroll: false ,

// Find position where image is dropped.
stop: function(event, ui) {

// Show dropped position.
var id=$(this).attr('id');
var ti=$(".rTabletd").attr("title");
var Stoppos = $(this).position();
model = {
id:id,
left: Stoppos.left,
top: Stoppos.top
};


$.ajax({
url: "/scrum/save",
type: "post",
data: model,
success: function(data){

jQuery.HP({
title: "Success!",
message: "Saved..."
});
},
error:function(){
// alert('error is saving');
}
});



}
});



});









share|improve this question






















  • Store the Id of the parent's div as well. So make sure an element's id is unique like it's supposed to.
    – dn Fer
    Nov 7 at 6:14










  • @dnFer can you please help me.please
    – Ezra
    Nov 7 at 6:19













up vote
0
down vote

favorite









up vote
0
down vote

favorite











This is continuation of my question first question



Here i am drag and drop sticky notes from one to another. i have



 <div class="rTable">
<div class="rTableRow">
<div id="a" title="Backog" class="rTableHead rTabletd"><strong>Backlog</strong></div>
<div id="a" title="WIP" class="rTableHead rTabletd"><span style="font-weight: bold;">WIP</span></div>
<div id="a" title="Testing" class="rTableHead rTabletd">Testing</div>
<div id="a" title="DOD" class="rTableHead rTabletd">DOD</div>
</div>
<div class="rTableRow rTableh" >
<div class="rTableCell"></div>
<div class="rTableCell"><a></a></div>
<div class="rTableCell"></div>
<div class="rTableCell"></div>
</div>

</div>


and sticky notes



<?php


foreach ($this->getallstores as $stories):

?>

<div id="draggable-<?php echo $stories['id']; ?>" class="draggable " onchange="javascript:position(this)" style="position:absolute; left: <?php echo $stories['_left']; ?>px; top: <?php echo $stories['_top']; ?>px">
<img class="pin" src="/manage/public/img/pin.png" alt="pin" />

<blockquote class="quote-box note-<?php echo $stories['color']; ?>">

<p class="quote-text" id="content-<?php echo $stories['id'];?>">
<?php echo $stories['message']; ?>
</p>
<hr>
<div class="blog-post-actions">
<p>
<button class="btn btn-primary popEdit pull-left" data-toggle='tooltip' title="Edit" onClick="popOverEdit(<?php echo $stories['id'];?>)" id="pop-<?php echo $stories['id'];?>"><span class="glyphicon glyphicon-edit"></span></button>
<div class="popover-markup blog-post-bottom" >

<div class="head hide">Edit</div>
<div class="content hide" id="popoverContent<?php echo $stories['id'];?>">
<div class="form-group">
<textarea id="<?php echo $stories['id']; ?>" class="quick" ><?php echo $stories['message']; ?></textarea>
</div>
<button data-vendor-id="" data-act="send" onClick="getText(<?php echo $stories['id'];?>)" class="btn btn-info save_notes">Save</button>
</div>
</div>
</p>
<p class="blog-post-bottom pull-right">
<a class="delete" href="?delete=<?php echo $stories['id']; ?>" style="float:right"> <button class="btn btn-danger" title="delete"><span class="glyphicon glyphicon-trash"></span></button> </a>
</p>
</div>
</blockquote>

</div>

<?php endforeach;?>


demo
enter image description here



my requirement is i want to drag and drop stickys and save to database.Now i have save position.is there any way to save column name?eg if drag sticky note from backlog to testing how can i get placed position name is testing?Please help me.



jquery



jQuery(function() {


jQuery( ".draggable" ).draggable({ containment: "#containment-wrapper", scroll: false ,

// Find position where image is dropped.
stop: function(event, ui) {

// Show dropped position.
var id=$(this).attr('id');
var ti=$(".rTabletd").attr("title");
var Stoppos = $(this).position();
model = {
id:id,
left: Stoppos.left,
top: Stoppos.top
};


$.ajax({
url: "/scrum/save",
type: "post",
data: model,
success: function(data){

jQuery.HP({
title: "Success!",
message: "Saved..."
});
},
error:function(){
// alert('error is saving');
}
});



}
});



});









share|improve this question













This is continuation of my question first question



Here i am drag and drop sticky notes from one to another. i have



 <div class="rTable">
<div class="rTableRow">
<div id="a" title="Backog" class="rTableHead rTabletd"><strong>Backlog</strong></div>
<div id="a" title="WIP" class="rTableHead rTabletd"><span style="font-weight: bold;">WIP</span></div>
<div id="a" title="Testing" class="rTableHead rTabletd">Testing</div>
<div id="a" title="DOD" class="rTableHead rTabletd">DOD</div>
</div>
<div class="rTableRow rTableh" >
<div class="rTableCell"></div>
<div class="rTableCell"><a></a></div>
<div class="rTableCell"></div>
<div class="rTableCell"></div>
</div>

</div>


and sticky notes



<?php


foreach ($this->getallstores as $stories):

?>

<div id="draggable-<?php echo $stories['id']; ?>" class="draggable " onchange="javascript:position(this)" style="position:absolute; left: <?php echo $stories['_left']; ?>px; top: <?php echo $stories['_top']; ?>px">
<img class="pin" src="/manage/public/img/pin.png" alt="pin" />

<blockquote class="quote-box note-<?php echo $stories['color']; ?>">

<p class="quote-text" id="content-<?php echo $stories['id'];?>">
<?php echo $stories['message']; ?>
</p>
<hr>
<div class="blog-post-actions">
<p>
<button class="btn btn-primary popEdit pull-left" data-toggle='tooltip' title="Edit" onClick="popOverEdit(<?php echo $stories['id'];?>)" id="pop-<?php echo $stories['id'];?>"><span class="glyphicon glyphicon-edit"></span></button>
<div class="popover-markup blog-post-bottom" >

<div class="head hide">Edit</div>
<div class="content hide" id="popoverContent<?php echo $stories['id'];?>">
<div class="form-group">
<textarea id="<?php echo $stories['id']; ?>" class="quick" ><?php echo $stories['message']; ?></textarea>
</div>
<button data-vendor-id="" data-act="send" onClick="getText(<?php echo $stories['id'];?>)" class="btn btn-info save_notes">Save</button>
</div>
</div>
</p>
<p class="blog-post-bottom pull-right">
<a class="delete" href="?delete=<?php echo $stories['id']; ?>" style="float:right"> <button class="btn btn-danger" title="delete"><span class="glyphicon glyphicon-trash"></span></button> </a>
</p>
</div>
</blockquote>

</div>

<?php endforeach;?>


demo
enter image description here



my requirement is i want to drag and drop stickys and save to database.Now i have save position.is there any way to save column name?eg if drag sticky note from backlog to testing how can i get placed position name is testing?Please help me.



jquery



jQuery(function() {


jQuery( ".draggable" ).draggable({ containment: "#containment-wrapper", scroll: false ,

// Find position where image is dropped.
stop: function(event, ui) {

// Show dropped position.
var id=$(this).attr('id');
var ti=$(".rTabletd").attr("title");
var Stoppos = $(this).position();
model = {
id:id,
left: Stoppos.left,
top: Stoppos.top
};


$.ajax({
url: "/scrum/save",
type: "post",
data: model,
success: function(data){

jQuery.HP({
title: "Success!",
message: "Saved..."
});
},
error:function(){
// alert('error is saving');
}
});



}
});



});






php jquery






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 7 at 5:53









Ezra

1219




1219












  • Store the Id of the parent's div as well. So make sure an element's id is unique like it's supposed to.
    – dn Fer
    Nov 7 at 6:14










  • @dnFer can you please help me.please
    – Ezra
    Nov 7 at 6:19


















  • Store the Id of the parent's div as well. So make sure an element's id is unique like it's supposed to.
    – dn Fer
    Nov 7 at 6:14










  • @dnFer can you please help me.please
    – Ezra
    Nov 7 at 6:19
















Store the Id of the parent's div as well. So make sure an element's id is unique like it's supposed to.
– dn Fer
Nov 7 at 6:14




Store the Id of the parent's div as well. So make sure an element's id is unique like it's supposed to.
– dn Fer
Nov 7 at 6:14












@dnFer can you please help me.please
– Ezra
Nov 7 at 6:19




@dnFer can you please help me.please
– Ezra
Nov 7 at 6:19












1 Answer
1






active

oldest

votes

















up vote
2
down vote



accepted










You can create an array and use the droppable index position to select the array value.



var table = ['Backlog', 'WIP', 'Testing', 'DOD'];






$(".rTableCell > div").draggable();
$(".rTableCell").droppable({
drop: function(event, ui) {
var table = ['Backlog', 'WIP', 'Testing', 'DOD'];
var droppedOn = event.target;
alert(table[$(droppedOn).index()]);
}
});

.rTableHead,
.rTableCell {
display: inline-block;
width: 23%;
}

.rTableCell {
border: 1px solid black;
height: 100vh;
}

.rTableCell>div {
background-color: blue;
padding: 5px;
color: white;
border-radius: 5px;
margin: 5px;
cursor: pointer;
}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

<script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>

<div class="rTable">
<div class="rTableRow">
<div id="backlog" title="Backog" class="rTableHead rTabletd"><strong>Backlog</strong></div>
<div id="WIP" title="WIP" class="rTableHead rTabletd"><span style="font-weight: bold;">WIP</span></div>
<div id="TESTING" title="Testing" class="rTableHead rTabletd"><span style="font-weight: bold;">Testing</span></div>
<div id="DOD" title="DOD" class="rTableHead rTabletd"><span style="font-weight: bold;">DOD</span></div>
</div>
<div class="rTableRow rTableh">
<div class="rTableCell">
<div>
Item 1
</div>
</div>
<div class="rTableCell">
<div>
Item 2
</div>
</div>
<div class="rTableCell">
<div>
Item 3
</div>
</div>
<div class="rTableCell">
<div>
Item 4
</div>
</div>
</div>

</div>








share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53184213%2fhow-to-get-dropped-div-name-jquery-drag-and-drop%23new-answer', 'question_page');
    }
    );

    Post as a guest
































    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    2
    down vote



    accepted










    You can create an array and use the droppable index position to select the array value.



    var table = ['Backlog', 'WIP', 'Testing', 'DOD'];






    $(".rTableCell > div").draggable();
    $(".rTableCell").droppable({
    drop: function(event, ui) {
    var table = ['Backlog', 'WIP', 'Testing', 'DOD'];
    var droppedOn = event.target;
    alert(table[$(droppedOn).index()]);
    }
    });

    .rTableHead,
    .rTableCell {
    display: inline-block;
    width: 23%;
    }

    .rTableCell {
    border: 1px solid black;
    height: 100vh;
    }

    .rTableCell>div {
    background-color: blue;
    padding: 5px;
    color: white;
    border-radius: 5px;
    margin: 5px;
    cursor: pointer;
    }

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

    <script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>

    <div class="rTable">
    <div class="rTableRow">
    <div id="backlog" title="Backog" class="rTableHead rTabletd"><strong>Backlog</strong></div>
    <div id="WIP" title="WIP" class="rTableHead rTabletd"><span style="font-weight: bold;">WIP</span></div>
    <div id="TESTING" title="Testing" class="rTableHead rTabletd"><span style="font-weight: bold;">Testing</span></div>
    <div id="DOD" title="DOD" class="rTableHead rTabletd"><span style="font-weight: bold;">DOD</span></div>
    </div>
    <div class="rTableRow rTableh">
    <div class="rTableCell">
    <div>
    Item 1
    </div>
    </div>
    <div class="rTableCell">
    <div>
    Item 2
    </div>
    </div>
    <div class="rTableCell">
    <div>
    Item 3
    </div>
    </div>
    <div class="rTableCell">
    <div>
    Item 4
    </div>
    </div>
    </div>

    </div>








    share|improve this answer

























      up vote
      2
      down vote



      accepted










      You can create an array and use the droppable index position to select the array value.



      var table = ['Backlog', 'WIP', 'Testing', 'DOD'];






      $(".rTableCell > div").draggable();
      $(".rTableCell").droppable({
      drop: function(event, ui) {
      var table = ['Backlog', 'WIP', 'Testing', 'DOD'];
      var droppedOn = event.target;
      alert(table[$(droppedOn).index()]);
      }
      });

      .rTableHead,
      .rTableCell {
      display: inline-block;
      width: 23%;
      }

      .rTableCell {
      border: 1px solid black;
      height: 100vh;
      }

      .rTableCell>div {
      background-color: blue;
      padding: 5px;
      color: white;
      border-radius: 5px;
      margin: 5px;
      cursor: pointer;
      }

      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

      <script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>

      <div class="rTable">
      <div class="rTableRow">
      <div id="backlog" title="Backog" class="rTableHead rTabletd"><strong>Backlog</strong></div>
      <div id="WIP" title="WIP" class="rTableHead rTabletd"><span style="font-weight: bold;">WIP</span></div>
      <div id="TESTING" title="Testing" class="rTableHead rTabletd"><span style="font-weight: bold;">Testing</span></div>
      <div id="DOD" title="DOD" class="rTableHead rTabletd"><span style="font-weight: bold;">DOD</span></div>
      </div>
      <div class="rTableRow rTableh">
      <div class="rTableCell">
      <div>
      Item 1
      </div>
      </div>
      <div class="rTableCell">
      <div>
      Item 2
      </div>
      </div>
      <div class="rTableCell">
      <div>
      Item 3
      </div>
      </div>
      <div class="rTableCell">
      <div>
      Item 4
      </div>
      </div>
      </div>

      </div>








      share|improve this answer























        up vote
        2
        down vote



        accepted







        up vote
        2
        down vote



        accepted






        You can create an array and use the droppable index position to select the array value.



        var table = ['Backlog', 'WIP', 'Testing', 'DOD'];






        $(".rTableCell > div").draggable();
        $(".rTableCell").droppable({
        drop: function(event, ui) {
        var table = ['Backlog', 'WIP', 'Testing', 'DOD'];
        var droppedOn = event.target;
        alert(table[$(droppedOn).index()]);
        }
        });

        .rTableHead,
        .rTableCell {
        display: inline-block;
        width: 23%;
        }

        .rTableCell {
        border: 1px solid black;
        height: 100vh;
        }

        .rTableCell>div {
        background-color: blue;
        padding: 5px;
        color: white;
        border-radius: 5px;
        margin: 5px;
        cursor: pointer;
        }

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

        <script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>

        <div class="rTable">
        <div class="rTableRow">
        <div id="backlog" title="Backog" class="rTableHead rTabletd"><strong>Backlog</strong></div>
        <div id="WIP" title="WIP" class="rTableHead rTabletd"><span style="font-weight: bold;">WIP</span></div>
        <div id="TESTING" title="Testing" class="rTableHead rTabletd"><span style="font-weight: bold;">Testing</span></div>
        <div id="DOD" title="DOD" class="rTableHead rTabletd"><span style="font-weight: bold;">DOD</span></div>
        </div>
        <div class="rTableRow rTableh">
        <div class="rTableCell">
        <div>
        Item 1
        </div>
        </div>
        <div class="rTableCell">
        <div>
        Item 2
        </div>
        </div>
        <div class="rTableCell">
        <div>
        Item 3
        </div>
        </div>
        <div class="rTableCell">
        <div>
        Item 4
        </div>
        </div>
        </div>

        </div>








        share|improve this answer












        You can create an array and use the droppable index position to select the array value.



        var table = ['Backlog', 'WIP', 'Testing', 'DOD'];






        $(".rTableCell > div").draggable();
        $(".rTableCell").droppable({
        drop: function(event, ui) {
        var table = ['Backlog', 'WIP', 'Testing', 'DOD'];
        var droppedOn = event.target;
        alert(table[$(droppedOn).index()]);
        }
        });

        .rTableHead,
        .rTableCell {
        display: inline-block;
        width: 23%;
        }

        .rTableCell {
        border: 1px solid black;
        height: 100vh;
        }

        .rTableCell>div {
        background-color: blue;
        padding: 5px;
        color: white;
        border-radius: 5px;
        margin: 5px;
        cursor: pointer;
        }

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

        <script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>

        <div class="rTable">
        <div class="rTableRow">
        <div id="backlog" title="Backog" class="rTableHead rTabletd"><strong>Backlog</strong></div>
        <div id="WIP" title="WIP" class="rTableHead rTabletd"><span style="font-weight: bold;">WIP</span></div>
        <div id="TESTING" title="Testing" class="rTableHead rTabletd"><span style="font-weight: bold;">Testing</span></div>
        <div id="DOD" title="DOD" class="rTableHead rTabletd"><span style="font-weight: bold;">DOD</span></div>
        </div>
        <div class="rTableRow rTableh">
        <div class="rTableCell">
        <div>
        Item 1
        </div>
        </div>
        <div class="rTableCell">
        <div>
        Item 2
        </div>
        </div>
        <div class="rTableCell">
        <div>
        Item 3
        </div>
        </div>
        <div class="rTableCell">
        <div>
        Item 4
        </div>
        </div>
        </div>

        </div>








        $(".rTableCell > div").draggable();
        $(".rTableCell").droppable({
        drop: function(event, ui) {
        var table = ['Backlog', 'WIP', 'Testing', 'DOD'];
        var droppedOn = event.target;
        alert(table[$(droppedOn).index()]);
        }
        });

        .rTableHead,
        .rTableCell {
        display: inline-block;
        width: 23%;
        }

        .rTableCell {
        border: 1px solid black;
        height: 100vh;
        }

        .rTableCell>div {
        background-color: blue;
        padding: 5px;
        color: white;
        border-radius: 5px;
        margin: 5px;
        cursor: pointer;
        }

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

        <script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>

        <div class="rTable">
        <div class="rTableRow">
        <div id="backlog" title="Backog" class="rTableHead rTabletd"><strong>Backlog</strong></div>
        <div id="WIP" title="WIP" class="rTableHead rTabletd"><span style="font-weight: bold;">WIP</span></div>
        <div id="TESTING" title="Testing" class="rTableHead rTabletd"><span style="font-weight: bold;">Testing</span></div>
        <div id="DOD" title="DOD" class="rTableHead rTabletd"><span style="font-weight: bold;">DOD</span></div>
        </div>
        <div class="rTableRow rTableh">
        <div class="rTableCell">
        <div>
        Item 1
        </div>
        </div>
        <div class="rTableCell">
        <div>
        Item 2
        </div>
        </div>
        <div class="rTableCell">
        <div>
        Item 3
        </div>
        </div>
        <div class="rTableCell">
        <div>
        Item 4
        </div>
        </div>
        </div>

        </div>





        $(".rTableCell > div").draggable();
        $(".rTableCell").droppable({
        drop: function(event, ui) {
        var table = ['Backlog', 'WIP', 'Testing', 'DOD'];
        var droppedOn = event.target;
        alert(table[$(droppedOn).index()]);
        }
        });

        .rTableHead,
        .rTableCell {
        display: inline-block;
        width: 23%;
        }

        .rTableCell {
        border: 1px solid black;
        height: 100vh;
        }

        .rTableCell>div {
        background-color: blue;
        padding: 5px;
        color: white;
        border-radius: 5px;
        margin: 5px;
        cursor: pointer;
        }

        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

        <script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>

        <div class="rTable">
        <div class="rTableRow">
        <div id="backlog" title="Backog" class="rTableHead rTabletd"><strong>Backlog</strong></div>
        <div id="WIP" title="WIP" class="rTableHead rTabletd"><span style="font-weight: bold;">WIP</span></div>
        <div id="TESTING" title="Testing" class="rTableHead rTabletd"><span style="font-weight: bold;">Testing</span></div>
        <div id="DOD" title="DOD" class="rTableHead rTabletd"><span style="font-weight: bold;">DOD</span></div>
        </div>
        <div class="rTableRow rTableh">
        <div class="rTableCell">
        <div>
        Item 1
        </div>
        </div>
        <div class="rTableCell">
        <div>
        Item 2
        </div>
        </div>
        <div class="rTableCell">
        <div>
        Item 3
        </div>
        </div>
        <div class="rTableCell">
        <div>
        Item 4
        </div>
        </div>
        </div>

        </div>






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 7 at 7:53









        slashsharp

        2,30111020




        2,30111020






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53184213%2fhow-to-get-dropped-div-name-jquery-drag-and-drop%23new-answer', 'question_page');
            }
            );

            Post as a guest




















































































            這個網誌中的熱門文章

            Xamarin.form Move up view when keyboard appear

            Post-Redirect-Get with Spring WebFlux and Thymeleaf

            Anylogic : not able to use stopDelay()