How can I retrieve an ancestor element with a certain data attribute by clicking one of its children elements?
I need to get the data-cell attribute when clicking either a <span> or a <div>. I tried to use node.parentElement, but when I click a span it returns me the div, and it's clear.
Is there something like node.parentElement.dataset.dataCell to get what I need?
<table>
<tr>
<td class="out" data-cell="3-2-2015">
<div>
<span> Number one </span>
<span> Number two </span>
<span> Number three </span>
</div>
</td>
</tr>
</table>
Aucun commentaire:
Enregistrer un commentaire