I have this code:
<button class="remove" value="1" />
<button class="remove" value="2" />
<button class="remove" value="3" />
$(document).on('click', ".remove", function(e) {
alert($(this).index());
});
It is always alerting 0. If the user clicked the button that has a value of 2, it must alert 1 but in my code it alerts 0.
Aucun commentaire:
Enregistrer un commentaire