Improve prev/next selection on delete.

remotes/origin/stable45
Thomas Tanghus 2012-06-24 01:48:37 +07:00
parent 0ab6e2ee3d
commit 9e6d2f2f82
1 changed files with 3 additions and 3 deletions

@ -380,12 +380,12 @@ Contacts={
if(jsondata.status == 'success'){
var newid = '', bookid;
var curlistitem = $('#contacts li[data-id="'+jsondata.data.id+'"]');
var newlistitem = curlistitem.prev();
var newlistitem = curlistitem.prev('li');
if(newlistitem == undefined) {
newlistitem = curlistitem.next();
newlistitem = curlistitem.next('li');
}
curlistitem.remove();
if(newlistitem != undefined) {
if(!$(newlistitem).is('li')) {
newid = newlistitem.data('id');
bookid = newlistitem.data('id');
}