Dynamic add button show wrong value jquery

<script type="text/javascript">
    var i = 0;
    var j = 1;
    $("#add").click(function(){
        ++i;
        var c = i + j;
        $("#dynamicpre").append('<div class="dynamicfields mb-5"><h5>Track:' + c + '</h5></div>');

    });
    $(document).on('click', '.remove-tr', function(){  
        $(this).closest('.dynamicfields').remove();
    });  
</script>

In the above question I am simply append a value through c variable. Now, What happen here when I click on add button it show Track:2 but when I click on remove and click again on add button then it show Track:3 but I want to show Track:2. So, How can I do this? Please help.

Thank You

53 thoughts on “Dynamic add button show wrong value jquery”

  1. pharmacie de garde aujourd’hui cherbourg pharmacie semnoz annecy , pharmacie angers grand maine pharmacie moderne amiens , Comprar Alli sin receta, DГіnde comprar Alli 60 mg. Comprar Alli sin receta Comprar Alli genГ©rico [url=https://kit.co/buikonderp/barato-alli-en-colombia-comprar-alli-sin-receta#]Comprar Alli medicamento[/url] pharmacie de garde niort Comprar Advair Diskus sin receta, Comprar Advair Diskus medicamento. Comprar Advair Diskus sin receta Comprar Advair Diskus genГ©rico [url=https://kit.co/speakdetse/advair-diskus-venta-online-comprar-advair-diskus-sin-receta#]Comprar Advair Diskus genГ©rico[/url] , traitement arthrose tel pharmacie vallee bailly , traitement zona. therapie comportementale et cognitive la rochelle act therapy criticism Comprar Cetirizina sin receta, DГіnde comprar Cetirizina 5 mg. Cetirizina en farmacia Chile Comprar Cetirizina genГ©rico [url=https://kit.co/terloball/barato-cetirizina-en-chile-comprar-cetirizina-sin-receta#]Comprar Cetirizina genГ©rico[/url] , pharmacie argenteuil geant. traitement indiciaire, pharmacie amiens maison de la culture pharmacie lafayette ivry . therapies have had considerable success in treating bedwetting, ketoconazole pharmacie en ligne therapies to cancer pharmacie bourges val d’auron .

    Reply

Leave a Comment