2
我可能會在這部分中丟失使用多個數組來匹配我的Unit over Size和數組內的靜態值。我想在這裏做的是讓每個電臺代表一個與選擇相匹配的數量。帶靜態數組的jQuery自定義計算器
例如,如果我在8平方米(尺寸)下單擊Low(單位)時,Array的靜態值應爲320 000 ...等等。與尺寸部分相同。
$(function(){
$("form #calc-standard li").each(function (i) {
i = i+1;
$(this).addClass("item"+i);
// Temporary pattern
var eightSqm = ["260 000", "320 000", "400 000"];
// Main pattern
var prices = [
["160 000", "210 000", "260 000", "310 000", "370 000"],
["190 000", "250 000", "320 000", "380 000", "440 000"],
["250 000", "310 000", "400 000", "480 000", "560 000"]
];
$("#calc-standard input[type='radio']").on("change", function(){
if($(this).val() == $(this).data('unit')) {
// Get the Unit by Matching the Temporary Pattern
var units = $(this).data('unit');
// Post Estimate Output
$("form #estimation").val(eightSqm[ units ]);
}
});
});
});
臨時模式是目前我在這裏使用的數組。我只需要弄清楚什麼是我需要用我的「主要模式」進行計算的正確條件。對不起我沒有在這裏...
這是我的示例完整的代碼。