JavaScript Delegate drag event to other element jQuery

I have following html on my page:

<div class="group-one" >
    <p><span id="handle" draggable="true">::</span> click me</p>
</div>

<div class="group-two" draggable="true">
    <p>I should be dragged</p>
</div>

Now what I want is that when #handle is dragged, the drag event should be delegated to div.group-two and element under move cursor should be div.group-two either. This is what I have tried:

$('#handle').mousedown(function(e){
    $('.group-two').trigger(e);
});

$('#handle').on('dragstart', function(e){
    $('.group-two').trigger(e);
});

$('.group-two').on('dragstart', function(e){
    console.log('dragestart triggered on group-two');
});

$('.group-two').mousedown(function(e){
    console.log("mousedown triggered on group-two");
});

Here is a jsfiddle.

The problem here is that although event is delegated to div.group-two but element being dragged under the move cursor is still span#handle.

Now my question is that, Is it possible to delegate drag in this manner? If it is, then any hint how to achieve it.

Note that I am using plain jQuery not jQuery UI.

Answer:1

I would like to create a timeout on each google marker's DROP animation, but I think the closure code for the marker and the array item are conflicting. I do not know too much about closures and am ...

I would like to create a timeout on each google marker's DROP animation, but I think the closure code for the marker and the array item are conflicting. I do not know too much about closures and am ...

  1. animation markers google maps
  2. custom animation google maps markers

In numerous JavaScript sources, I have seen a preference of calling Object.prototype.hasOwnProperty from a static reference as in the following example: var hasOwnProp = Object.prototype....

In numerous JavaScript sources, I have seen a preference of calling Object.prototype.hasOwnProperty from a static reference as in the following example: var hasOwnProp = Object.prototype....

I am trying to raise a Javascript confirm box from code behind. I am using the following syntax ScriptManager.RegisterStartupScript(this, GetType(), "key", "javascript:return confirm('Are you sure ...

I am trying to raise a Javascript confirm box from code behind. I am using the following syntax ScriptManager.RegisterStartupScript(this, GetType(), "key", "javascript:return confirm('Are you sure ...

I am trying to visualise "investment value" over "APR" and my data looks like this: 7.4: 2000 7.4: 300 7.9: 1000 8.0: 15000 8.0: 730 8.3: 700 Each line here represents a borrower, who offered to ...

I am trying to visualise "investment value" over "APR" and my data looks like this: 7.4: 2000 7.4: 300 7.9: 1000 8.0: 15000 8.0: 730 8.3: 700 Each line here represents a borrower, who offered to ...

  1. best chart to display outliers and mean
  2. best chart to display performance over time
  3. best chart to display data over time
  4. best chart to display percentages
  5. best chart to display proportion of a multiple components
  6. best chart to display ranking
  7. best chart to display trends over time
  8. best chart to display survey results
  9. best chart to display time
  10. best chart to display data
  11. best chart to display proportion of a single component
  12. best chart to display proportion of a single component in excel
  13. best visual display chart in excel