I have function, which on change calling method 'saveSelectedValue'.
this.$filtercat.on('change', { that : this }, this.saveSelectedValue);
This method does only one thing: saving data in array.
saveSelectedValue : function (e) {
var that = e.data.that,
selectArray = that.filterSelectedCategories;
selectArray.push($('.posts-filter-cat').val());
console.log(selectArray); //every time gives me extended array
},
Now I am adding new value to the existing array. But I want to delete everything and add new value in array on every change.