This is my click event. Why does it become new every time I add an element?
闭关修行中......
...Your arr is in the event and is a new arr every time. .
Because you initialize arr to new data every time var arr = [];You should initialize arr on the click method
Put var attr= []; outside the function and promote it to a global variable, and you should be fine.
...Your arr is in the event and is a new arr every time. .
Because you initialize arr to new data every time var arr = [];
You should initialize arr on the click method
Put var attr= []; outside the function and promote it to a global variable, and you should be fine.