理由はわかりませんが.parent()
、動的に作成された要素に取り組んでいません。
ここに私の問題を表示するフィドルがあります。作成されたものではなく、静的要素の割引価格を計算します。
$('.item-sizes .discount-percent').live('keydown', function () {
var percentValue = $(this).val();
var basePrice = $('.base-price', $(this).parent().parent()).val(); // Undefine on live elements, defined on static
if (basePrice) {
discountValue = basePrice - ((percentValue / 100) * basePrice);
$('.discount-price', $(this).parent().parent()).val(discountValue);
}
});