0

I tried using:

$("#userInput").appendTo("gList") //The name of my variable is gList

but it didn't work.

2
  • 1
    Please look in the documentation. You want var gList=$("#userInput").val(); Commented Nov 28, 2015 at 6:48
  • If gList is an array: gList.push( $("#userInput").val() ); Commented Nov 28, 2015 at 8:53

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.