Comment puis-je obtenir la position d'un élément enfant
j'ai besoin de trouver la position d'un élément enfant.
j'ai une table et quand un td est cliqué, je veux que la position de la td(0,1 ou 2)
<table>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
et un script comme celui-ci
<script>
$("td").click(function(){
//how do i get the position of the td?
alert("column " + columnPosition + "is clicked")
});
</script>
source d'informationauteur MichaelD
Vous devez vous connecter pour publier un commentaire.
edit: je l'ai testé, et ça marche
Juste pour la référence, et c'est une bonne
reportez-vous ici