jQuery événement - attribut target
Exemple
Afficher quel élément DOM a déclenché l'événement :
$("p, button, h1, h2").click(function(event){ $("div").html("Déclenché par un " + event.target.nodeName + " element."); });
Définition et utilisation
L'attribut target spécifie quel élément DOM a déclenché cet événement.
Syntaxe
event.target
Paramètres | Description |
---|---|
event | Obligatoire. Définir l'événement à vérifier. Ce event Les paramètres viennent de la fonction de liaison d'événement. |