这是我到目前为止所尝试的。没有得到如何在阵列只更新变量值如何更新数组中的特定变量值?
allVals = [];
var qty;
jQuery(".big:checked").each(function() {
qty = parseInt(jQuery(this).parents().nextAll().children().find('input[name="quantity"]').val());
if (jQuery.inArray(jQuery(this).val(), allVals) == -1) {
allVals.push(jQuery(this).val() + ',' + qty + ',' + 'custcol_name_of_attendees|' + nameatt + '||custcol_email_of_attendees|' + emattendee + '||custcol_event_name|' + eventname + '| |custcol_event_location|' + eventlocation); //not present in array
} else {
qty = parseInt(jQuery(this).parents().nextAll().children().find('input[name="quantity"]').val()) + 1;
// update only qty value in allVals array
}
});
我想+1每次在阵列发现重复的项目时间,增加数量变量的值
什么的'('输入的值[NAME =“量“]')。val()'? –
它会给我选定的复选框数量字段值....它将是像1,2,3等整数 – Uidev123