Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Recognizing click on a div
Message
De
15/03/2016 05:41:15
 
 
À
14/03/2016 21:19:18
Information générale
Forum:
Javascript
Catégorie:
Autre
Divers
Thread ID:
01633076
Message ID:
01633099
Vues:
71
This message has been marked as the solution to the initial question of the thread.
>Ok, so this takes care of it:
>
>http://jsfiddle.net/DUhP6/181
>
>Basically, I have to go up to chain until I find a specific div I can rely on.
>
>The click on the outside container would then be as follow:
>
>
>document.getElementById('outer-container').onclick = function(e) {
>loTarget=e.target
>while (loTarget.parentNode)
>{
>   loTarget=loTarget.parentNode
>   if (loTarget.id=='DivIFrame')
>   {
>      return false
>   }
>}
>alert('Clicked on outside window')
>}
>
>
>If someone knows a better or simpler way, feel free to share.

Something like :
if ( document.getElementById("content-area").contains(e.target))
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform