title: Get the data-target dynamically
body: <p>I have the follwing link:</p>
  
  <pre><code>&lt;a href="edit/2" class="popup" data-toggle="modal" data-target="#productVariantModal"&gt; &lt;span class="glyphicon glyphicon-edit"&gt;&lt;/span&gt;&lt;/a&gt;
  </code></pre>
  
  <p>I would like to get the data-target dynamically so I could reuse my javescript code.</p>
  
  <p>I have tried something like this:</p>
  
  <pre><code>  var target = $(this).closest('[data-target]');
  </code></pre>
  
  <p>But this does't work. </p>
  
  <p>Any Suggestions are welcome.</p>
  
  <p>Thanks.</p>