mardi 12 juillet 2016

How to write an if/else statement to check whether or nor a child element is selected?

Imagine I have a div with a few descendants/children as such:

<div class="currenTile" tabindex="0">
  <h1 tabindex="0"> my Header </h1>
  <p tabindex="0"> some text </p>
  <ul tabindex="0">
     <li tabindex="0"> item 1 </li>
     <li tabindex="0"> item 2 </li>
     <li tabindex="0"> item 3 </li>
  </ul>
</div>

I want to create an "if/else" statement that checks after a keydown event, if an element has focus AND is a child of the 'currentTile' div, to do something. Any idea on how to do this?

Aucun commentaire:

Enregistrer un commentaire