Méthode jQuery select()

❮ Méthodes d'événement jQuery

Exemple

Alerter un message lorsqu'un texte est sélectionné dans un champ de texte :

$("input").select(function(){
  alert("Text marked!");
});

Définition et utilisation

L'événement select se produit lorsqu'un texte est sélectionné (marqué) dans une zone de texte ou un champ de texte.

La méthode select() déclenche l'événement select ou attache une fonction à exécuter lorsqu'un événement select se produit.


Syntaxe

Déclenchez l'événement select pour les éléments sélectionnés :

$(selector).select()

Attachez une fonction à l'événement select :

$(selector).select(function)

Parameter Description
function Optional. Specifies the function to run when the select event is triggered

❮ Méthodes d'événement jQuery