jquery erhalten spezifische ID
Ich habe dies für meine Schulprojekt, aber meine Frage ist jetzt:
ich hinzufügen neue Autos Mein Warenkorb enthält und wenn ich ein anderes Auto die erste Auswahl ändert sich auch. Alle markierten Autos hatte seinen eigenen Preis, aber wenn ich ein anderes Auto die ganze Preis sind gleiche wählen:
Mein Code:
$('.productprijzen').hide();
var $select = $('<select>').addClass('keuzes');
$select.append('<option>Kies je optie</option>');
$select.append('<option value="volvo">Volvo</option>');
$select.append('<option value="saab">saab</option>');
$select.append('<option value="peugeot">peugeot</option>');
$select.append('<option value="mazda">mazda</option>');
$select.on('change', function()
{
console.log();
$parent = $(this).closest(".row");
$('.productprijzen',$parent).slideDown();
var merk = $(this).val();
var productInfo = oProducten[merk];
$('.prijs').html("€" + productInfo.prijs);
$('.btw').html(productInfo.btw+ "%");
//$('.aantal').html(productInfo.btw+ "%");
// berekening van aantal x prijs
var $aantalKeuze = $('input.aantal');
var $subtotaal = $('.qty');
$aantalKeuze.change(function() {
$subtotaal.html((productInfo.prijs * $aantalKeuze.val()));
});
});
$product = $(".producttemplate");
$('.productkeuzes',$product).append($select.clone(true));
var $i = 1;
$(".nieuw").click(function() {
$('.producten').append($product.clone(true).addClass('single product'+$i).removeClass('producttemplate'));
$i++;
});
});
können Sie die HTML bereitstellen? – madalinivascu