In my following code:
addUserHandler: function () {
var $user = this.$('#user');
if (($user.val().length > 0) && ($user.val() === $user.data('name'))) {
this.addUser($user.data());
}
$user.val('');
return false;
}
When I add the first user and then if I select another user from the autocomplete
text field, it actually replaces the previously selected item's data with the new one. So always all the previously selected items will be replaced with the final one.
I'm using jQuery 2.0 and this issue started to occur after I updated from jQuery 1.9.
Anyone know any recent changes that jQuery has done for $.data()
I tried to find some proper solutions, but couldn't found any.
Thanks
Change the line
to
or simply