나는 모바일 애플 리케이션에있어 확인란의 값으로 배열을 채우고 싶습니다.jquery 배열을 채우는 방법
내 코드
if (row.flatdescription == flatdescription) {
if (row.receiptno == 0){
items.push('<input type="checkbox" name="code_'+ i +'" id="code_'+ i +'" value="' + row.amount + '" previous="' + row.pastpayments + '" barcode="' + row.barcode + '" todayp="' + row.todaypayments + '"/><label for="code_'+ i +'">' + row.period +'..........'+ row.amount+'</label></br>');
}
allbarcode[i] = row.barcode;
previouspayments1 = previouspayments1 + row.pastpayments;
previouspayments = previouspayments1.toFixed(2);
sofeilon1 = sofeilon1 + row.amount;
sofeilon = sofeilon1.toFixed(2);
total1 = total1 + row.amount - row.pastpayments;
total = total1.toFixed(2);
}
내 배열 코드
function barcodeTotal() {
barcode = [];
barcodeamount = [];
barcodeprevious = [];
$("input:checked").each(function(i) {
barcode[i] = $(this).attr("barcode");
barcodeamount[i] = $(this).attr("value");
barcodeprevious[i] = $(this).attr("previous");
});
}
내 목표는 내가 답을 주셔서 감사합니다이
barcode [barcode: barcode, amount: value, previous: previous, ....
같은 바코드 배열을 채우기 위해입니다
은 내가 제안 된 변경 사항을하지만 난] 경고 [개체 개체에 [개체 개체를받을 ] 함수 barcodeTotal() { \t \t \t \t var self = this; \t \t \t \t var barcodes = []; \t \t \t \t $ ("입력 : 선택"). 각 (기능 (전, 항목) { \t \t \t \t \t barcodes.push ({ \t \t \t \t \t \t 바코드 : $ (자기) .attr ("바코드"), \t \t \t \t \t \t 금액 : $ (자기) .attr ("값"), \t \t \t \t \t \t 이전 : $ (자체) .attr ("이전") \t \t \t \t \t}); \t \t \t \t \t // barcode [i] = $ (this) .attr ("barcode"); \t \t \t \t \t // barcodeamount [i] = $ (this) .attr ("value"); \t \t \t \t \t // barcodeprevious [i] = $ (this) .attr ("previous"); \t \t \t}); 알림 (바코드); \t \t \t} – kosbou