var prev = [];
var count = 0;
var data = '';
$('#add_ref').click(function(){
var man_val = $.trim($('#manual_ref').val());
if(($.inArray(man_val,prev))==-1){
if(man_val != ''){
count += 1;
prev[1] = man_val;
alert(prev[i);// Problem is here
data = '<li id="45" class="as-selection-item"><a class="as-close">x</a> '+ man_val +' <input id="notal_45" class="cls-notal" type="checkbox" value="45" name="notal_chk[]"></li>';
$('#ul-rtl-ref-1').append(data);
}
}
}
);
为什么它不为数组赋值?如果我写prev[1] = "myvalue"
它也不起作用。警报总是显示未定义
编辑prev.push(man_val) 显示推送不是函数