我尝试使用:
$("#userInput").appendTo("gList") //The name of my variable is gList
但它不起作用。
答案 0 :(得分:1)
据我所知gList
这是一个数组,所以你必须做下一个
var gList = [];
// ... do some job
var inputValue = $("#userInput").val(); //console.log(inputValue)
gList.push(inputValue); // console.log(gList)
如果gList
是一个字符串,您可以将其连接gList = gList + inputValue
由于