obtenir jquery `$(this)` id

Comment puis-je obtenir le id de l'élément qui a déclenché l'jQuery .change() fonction?
La fonction elle-même fonctionne correctement, mais j'ai besoin d'une action spécifique pour un sélecteur avec id="next".

$("select").change(function() {
    [...snip....]
    alert( $(this).attr('id') );  //<---- not working
}

Des idées pourquoi l'alerte ci-dessus ne fonctionne pas?

  • On dirait qu'il travaille pour moi... jsfiddle.net/interdream/nGtjR/1
  • Êtes-vous essayer d'obtenir l'id de l'élément select votre changement de gestionnaire est attaché?
InformationsquelleAutor Gigg | 2011-06-14