每次按下按钮时,我都需要使用javascript填充数组。
例如:如果数组是{[10,2,5]}
,我又点击了按钮,它应该是{[10,2,5],[6,3,4]}
$('#button').click(function() {
//populating array keeping old data everytime user push button.
}
<form id="myForm">
//data that ill go to array
<input type="button" id="button" value="ok">
</form>
答案 0 :(得分:3)
var myArray = [];
$('#button').click(function(){
var newArray = [];
myArray.push(newArray);
});