Works from the second click, everything is duplicated and how much?

karzina function (){

$('.zakaz').click(function(){
 var chto_id = $(this).parent().attr('id');
 var chto = $(this).parent();
 var sprav = $('.tovar').attr('id');
 var pText = $(chto).find("#rectangle p").text();
 var colText = $(chto).find("#colznach").text();
 var cenText = $(chto).find("span#cenznach").text();
 var idExists = false;


$('.tovar').each(function(){
 if(this.id == chto_id){
 idExists = true;
 var obj = this.id;
 var chq = $(obj).find('#dosname')
console.log(her);
 $('.doska').append('<div class="tovar" id="+chto_id+"> <div id="dosname"> '+pText+' </div> <div id="doscol"> </div> <div id="doscen"> '+cenText+' </div></div>');


}
});

 if (idExists){
console.log("true");


 } else {
 $('.doska').append('<div class="tovar" id="+chto_id+"> <div id="dosname"> </div> <div id="doscol"> </div> <div id="doscen"></div></div>');
};
});

 };

Here's the code, who is highly versed help , what's the problem?
P. S used ajax uploading
July 9th 19 at 13:55
1 answer
July 9th 19 at 13:57
Solution
Figured out

Find more questions by tags jQuery