title: How to implement drag and drop so dragging child element will drag whole parent element
body: <p>I'm working on a media import plugin for wordpress. I'm trying to implement a drag and drop feature to reorder media elements(audio and/or images) that the user has imported. I have a <code>&lt;div&gt;</code> tag(we'll call these <em>media divs</em>) that holds up to three other <code>&lt;span&gt;</code>, <code>&lt;img&gt;</code>, or <code>&lt;audio&gt;</code> tags. So I have all the media assets that have been imported displayed in a line and would like to be able to drag and drop to reorder the <em>media divs</em>. I have no problem implementing the basic drag and drop using html5. My problem is that right now when I click on the media child elements(<code>&lt;audio&gt;</code> or <code>&lt;img&gt;</code>) inside the <em>media divs</em>, the child element is the target of the drag event. Is there any way I can reset the target of the drag event to be the parent element so I drag the whole <em>media div</em> and not just the media element? I've looked into <code>e.stopPropogation()</code> and read up on bubbling, and capturing but every way I've tried to utilize those, it doesn't solve my problem. Is there something I'm missing? I would prefer to avoid jQuery if possible and definitely can't use any libraries or frameworks. <br> <strong>TL;DR: How can I make the parent element the target of a drag event when a child element is clicked?</strong> <br> <br></p>
  
  <pre><code>&lt;div class="npr-import-media npr-import-audio npr-import-images" id="media-container"&gt;
  
      &lt;div class="npr-import-media-container" draggable="true"&gt;
          &lt;audio src="&lt;?php echo $audio-&gt;format-&gt;mp4-&gt;{'$text'}; ?&gt;" controls&gt;&lt;/audio&gt;
          &lt;span class="npr-media-delete"&gt;X&lt;/span&gt;
      &lt;/div&gt;
  
      &lt;div class="npr-import-image-container npr-import-media-container" draggable="true"&gt;
          &lt;img class="npr-import-image" src="&lt;?php echo $image-&gt;src; ?&gt;" &gt;
          &lt;span class="npr-import-image-caption"&gt;&lt;?php echo $image-&gt;caption-&gt;{'$text'} ?&gt;&lt;/span&gt;
          &lt;span class="npr-media-delete"&gt;X&lt;/span&gt;
      &lt;/div&gt;
  
      &lt;div class="npr-import-add-media npr-import-media-container"&gt;
          Add Media+
      &lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>This is the HTML portion of my code. There is originally some more php functionality to loop through the original source material to display all of the media elements being imported in from the original article, but I don't think it's necessary to include that.</p>