我试图用 join() 分隔数组值,但它似乎不起作用,它只返回数组的最后一个值。如果我使用警报,它会同时显示值。
var span_text=100;
var val= [window["tma"+kj]; //input box values from input 1 - 20 e.g. tma1, tma2,......,tma20
if(span_text<250){
if(val>=5 && val<=10){
$(div3).show();// dth div shown if the condition is met
counter1++; // number of elements in found in the condition
var once =[window["tma"+kj].toFixed(2)];//value of the input box in an array concatinated to two deciamal places
var kl = new Array(once);
var alphy= kl.join(',');
$('#com').val(alphy);
}
}