I am trying push elements to an array dynamically. But my code is not working. I want to add array elements onclick in jquery. When i push an element its getting added but when i am trying to add second element first element is removed and only second element is added. Not able to add elements dynamically.I am trying push elements to an array dynamical