I tried using:
$("#userInput").appendTo("gList") //The name of my variable is gList
but it didn't work.
As i understand this gList this is an array so you have to do next
var gList = [];
// ... do some job
var inputValue = $("#userInput").val(); //console.log(inputValue)
gList.push(inputValue); // console.log(gList)
If gList is a string you can concatenate it gList = gList + inputValue
Thanks
var gList=$("#userInput").val();gList.push( $("#userInput").val() );