Sunday, 8 September 2013

jquery Append add same value always

jquery Append add same value always

i use this jQuery code for append new div to another:
$('#sklep').on('click', '.kup', function() {
var cena=$('#cena').text();
var tytul=$('#tytul').text();
var iden=$('#id').text();
var suma=$('#koszykdiv .cyfry').text();
var dodawanie=parseInt(cena) +parseInt(suma);
$('.cyfry').text(dodawanie);
var source=$("#miniatura").attr("src");
$('.koszyk_content_items').append($('<div class="item_koszyk"><div
class="miniatura_koszyk"><img width="165" height="110"
src="'+source+'"/></div><span id="opis">'+tytul+' - '+cena+' z³ -
</span><span class="identyfikator" style="display:none;">'+iden+'</span><a
href="#" class="usun" id="delete">USUÑ</a></div>'));
var licznik=$('#koszykdiv .licznik').text();
alert(licznik);
$('#identyfikator').text(licznik);
var licznik_dodawanie=parseInt(licznik)+1;
$('#koszykdiv .licznik').text(licznik_dodawanie);
$.cookie("obraz"+licznik_dodawanie,id);
var cena='';
var tytul='';
var iden='';
var source='';
});
but it always append div with the same variables values, even if parent of
'.kup' href has another text values. Can you help me and tell where the
problem is?

No comments:

Post a Comment