我正在尝试从输入中获取值,如果值 = 1,2,3... 则显示其他内容,如果值 = 4,5,6... 则显示其他内容。我几乎让它工作了,然后东西坏了。我玩这个已经很久了。任何人都可以快速查看并指出我在哪里弄坏了它。
var amount = $(".quantity-wrapper > .input-text").val();
if(amount = '1') {
$('.product-addon-one-attendee').show();
}
if(amount = '2'){
$('.product-addon-one-attendee').show();
$('.product-addon-two-attendees').show();
}
if(amount = '3'){
$('.product-addon-one-attendee').show();
$('.product-addon-two-attendees').show();
$('.product-addon-three-attendees').show();
}
if(amount = '4'){
$('.product-addon-one-attendee').show();
$('.product-addon-two-attendees').show();
$('.product-addon-three-attendees').show();
$('.product-addon-four-attendees').show();
}
if(amount = '5'){
$('.product-addon-one-attendee').show();
$('.product-addon-two-attendees').show();
$('.product-addon-three-attendees').show();
$('.product-addon-four-attendees').show();
$('.product-addon-five-attendees').show();
}
if(amount = '6'){
$('.product-addon-one-attendee').show();
$('.product-addon-two-attendees').show();
$('.product-addon-three-attendees').show();
$('.product-addon-four-attendees').show();
$('.product-addon-five-attendees').show();
$('.product-addon-six-attendees').show();
}
if(amount = '7'){
$('.product-addon-one-attendee').show();
$('.product-addon-two-attendees').show();
$('.product-addon-three-attendees').show();
$('.product-addon-four-attendees').show();
$('.product-addon-five-attendees').show();
$('.product-addon-six-attendees').show();
$('.product-addon-seven-attendees').show();
}
if(amount = '8'){
$('.product-addon-one-attendee').show();
$('.product-addon-two-attendees').show();
$('.product-addon-three-attendees').show();
$('.product-addon-four-attendees').show();
$('.product-addon-five-attendees').show();
$('.product-addon-six-attendees').show();
$('.product-addon-seven-attendees').show();
$('.product-addon-eight-attendees').show();
}
if(amount = '9'){
$('.product-addon-one-attendee').show();
$('.product-addon-two-attendees').show();
$('.product-addon-three-attendees').show();
$('.product-addon-four-attendees').show();
$('.product-addon-five-attendees').show();
$('.product-addon-six-attendees').show();
$('.product-addon-seven-attendees').show();
$('.product-addon-eight-attendees').show();
$('.product-addon-nine-attendees').show();
}
if(amount = '10'){
$('.product-addon-one-attendee').show();
$('.product-addon-two-attendees').show();
$('.product-addon-three-attendees').show();
$('.product-addon-four-attendees').show();
$('.product-addon-five-attendees').show();
$('.product-addon-six-attendees').show();
$('.product-addon-seven-attendees').show();
$('.product-addon-eight-attendees').show();
$('.product-addon-nine-attendees').show();
$('.product-addon-ten-attendees').show();
}
if(amount = '11'){
$('.product-addon-one-attendee').show();
$('.product-addon-two-attendees').show();
$('.product-addon-three-attendees').show();
$('.product-addon-four-attendees').show();
$('.product-addon-five-attendees').show();
$('.product-addon-six-attendees').show();
$('.product-addon-seven-attendees').show();
$('.product-addon-eight-attendees').show();
$('.product-addon-nine-attendees').show();
$('.product-addon-ten-attendees').show();
$('.product-addon-eleven-attendees').show();
}
if(amount = '12'){
$('.product-addon-one-attendee').show();
$('.product-addon-two-attendees').show();
$('.product-addon-three-attendees').show();
$('.product-addon-four-attendees').show();
$('.product-addon-five-attendees').show();
$('.product-addon-six-attendees').show();
$('.product-addon-seven-attendees').show();
$('.product-addon-eight-attendees').show();
$('.product-addon-nine-attendees').show();
$('.product-addon-ten-attendees').show();
$('.product-addon-eleven-attendees').show();
$('.product-addon-twelve-attendees').show();
}