i'm trying to give the user the possibility to update the values of some fields concerning him by clicking on a container named #info-client Here I append the input areas after the click and once the #finish button is clicked the infos will then be updated. The problem i got is that the infos were updated yet they were showed more than once ( 2 times or even 3 .. )
$("#info-client").one('click', function() {
$("#info-client").children().hide();
// liste des champs
var c1 = $('<label> Nom : </label><input type="text id="identifiant"> <br>');
var c2 = $('<label> Adresse : </label><input type="text" id="adresse"><br>');
var c3 = $('<label> Ville : </label><input type="text" id="ville"><br>');
var c4 = $('<label> Tel : </label><input type="text" id="tel"> <br>');
var c5 = $('<label> Fax : </label><input type="text" id="fax"> <br>')
var button = $('<input type="button" id="finish" value="Mettre à jour">');
$("#info-client").append(c1);
$("#info-client").append(c2);
$("#info-client").append(c3);
$("#info-client").append(c4);
$("#info-client").append(c5);
$("#info-client").append(button);
$("#finish").one('click', function() {
var identifiant = $('#identifiant').val();
var adresse = $('#adresse').val();
var ville = $('#ville').val();
var tel = $('#tel').val();
var fax = $('#fax').val();
c1.replaceWith("<h4>" + identifiant + "</h4>");
c2.replaceWith("<p> Adresse : " + adresse + "</p>");
c3.replaceWith("<p>" + ville + "</p>");
c4.replaceWith("<p>Fax : " + tel + "</p>");
c5.replaceWith("<p> Tel :" + fax + "</p>");
});
});