samedi 10 février 2018

Get data-id of anchor element inside a li element

Html

<ul>
  <li>
    <a href="" data-id="1" onclick="click();"></a>
  </li>
  <li>
    <a href="" data-id="2" onclick="click();"></a>
  </li>
  <li>
    <a href="" data-id="3" onclick="click();"></a>
  </li>
  <li>
    <a href="" data-id="4" onclick="click();"></a>
  </li>
  <li>
    <a href="" data-id="5" onclick="click();"></a>
  </li>
</ul>

My app got a list of things then after 5secs. it will automatically go to the next li. but that is not the problem. the problem is with the click function I want to know the data-id of the li.




Aucun commentaire:

Enregistrer un commentaire