How to make a blank variable?

$('body').on('click', '#buy', function(){
 var bekon = $(this).parents().find("input[name='group1']:checked").val();
 var kurica = $(this).parents().find("input[name='group2']:checked").val();
 var salyami = $(this).parents().find("input[name='group3']:checked").val();
 var tomaty = $(this).parents().find("input[name='group4']:checked").val();
 var chto_id = $(this).parent().attr('id');
 var pText = $('#margarita').text();
 var colText = '1';
 var cenText = $(this).parent().find('span.cena').text();
 var be_con = "";
 var kur_ica = ";
 var sa_lyami = ";
 var tom_aty = ";
 var btg =";
 var bgr =";
 var ktg =";
 var kgr =";
 var stg = ";
 var sgr =";
 var ttg =";
 var tgr=";
 var idExists = false;

 if ($(this).parents().find("input[name='group1']:checked").is(':checked')){ be_con=bekon; btg = '150'; bgr = '50' ;};
 if ($(this).parents().find("input[name='group2']:checked").is(':checked')){ kur_ica=kurica ; ktg = '150'; kgr='50'; };
 if ($(this).parents().find("input[name='group3']:checked").is(':checked')){ sa_lyami=salyami; stg = '150'; sgr ='50'; };
 if ($(this).parents().find("input[name='group4']:checked").is(':checked')){ tom_aty=tomaty; ttg='150'; tgr='50';};

 console.log(bekon , kurica, salyami, tomaty)

 if( == chto_id){
 idExists = true;
 obj =;
 var chq = $(obj).find('#dosname')
 if(idExists) {$(this).remove()}


 if (idExists){

 } else {
 $('.doska').append('<div class="tovar" id="+chto_id+"> <div id="dosname"> '+pText+'</div> <div id="doscol"> '+colText+' </div> <div id="doscen">'+cenText*colText+' </div> <div class="bekon" style="text-align:left; padding-left:15px"> '+be_con+' <div id="doscol"> '+bgr+' </div> <div id="doscen">'+btg+' </div> </div><div class="kurica" style="text-align:left; padding-left:15px"> '+kur_ica+' <div id="doscol"> '+kgr+' </div> <div id="doscen">'+ktg+' </div> </div><div class="salyami" style="text-align:left; padding-left:15px"> '+sa_lyami+' <div id="doscol"> '+sgr+' </div> <div id="doscen">'+stg+' </div> </div><div class="tomaty" style="text-align:left; padding-left:15px "> '+tom_aty+' <div id="doscol"> '+tgr+' </div> <div id="doscen">'+ttg+' </div> </div></div>');

The variable is inserted in div. Because this variable appears the height of the diva , it is necessary that the height was not.
July 9th 19 at 11:21
2 answers
July 9th 19 at 11:23
Even if you remove all the spaces between the blocks anyway

divthat contains another div with inline-block is considered as a div that has inside a single space.
Can be solved with css (example or another example), but not in the way that you are now piled on the site)
Thanks,.. the basics of css. - Lottie_Streich commented on July 9th 19 at 11:26
July 9th 19 at 11:25
try to start the spaces between the tags in the append to remove
The first thing that came to mind was just that, not helping - Lottie_Streich commented on July 9th 19 at 11:28
I'm thinking all of the matter in peremennyh - Lottie_Streich commented on July 9th 19 at 11:31
: you can post it on jsfiddle? - Lottie_Streich commented on July 9th 19 at 11:34

div {

I think that'll solve everything - camren_Ber commented on July 9th 19 at 11:37
: A few is not logical but nevertheless I checked did not help - Magdalena.Wym commented on July 9th 19 at 11:40

Find more questions by tags jQuery