Jak wyżej chce wyświetlić sobie numer aktualnego wiersza w jQuery ponieważ potrzebne jest mi to do edycji wiersza dowolnego a nie wszystkich jak dzieje mi się to teraz zamieszczam kod.
var i = 1; $(document).ready(function() { $("#dodaj").click(function() { var imie = $("#imie").val(); var wiersz = ("<tr class='wiersz'><td class='first'></td><td class='wImie'>" + imie + "</td><td><button class='usun'>Usuń</button></td><td><button class='edytuj'>Edycja</button></td></tr>"); $("#tB").append(wiersz); $(".first").each(function(i) { $(this).text(i+1); }); }); $("#tB").on("click",".usun",function() { $(this).parent().parent().remove(); $(".first").each(function(i) { $(this).text(i+1); }); }); $("#tB").on("click",".edytuj",function() { var wiersz = $("<tr><td></td><td><input type='text' placeholder='Podaj imię' id='wImie'/></td><td><button class='zapis'>Zapisz </button></td><td><button class='anuluj'>Anuluj</button></td></tr>"); $(this).closest('tr').after(wiersz); }); $("#tB").on("click",".anuluj",function(){ $(this).parent().parent().remove(); }); $("#tB").on("click",".zapis",function(){ var noweImie = $("#wImie").val(); $(".wImie").text(noweImie); $(this).parent().parent().remove(); }); });