Click here to Skip to main content
15,899,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,


I want to add the array dynamically using jquery. How can i do that.(or)

I want to push the elements in to array like this.

var array = [{"question":"1","answer":"2"}];
i want to do that dynamically using for loop i mean
initially i will add
array.push({"question":"1"});
then array.push({"answer":"2"});
but i want the elements to in the same array[0] element
but it is taking as array[0],array[1]
How can i do that. I am using for loop to add the elements in to the array

Regards,
Srinivas
Posted

1 solution

 
Share this answer
 
Comments
SrinivasNaidu 16-Nov-12 8:13am    
thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900