diff --git a/js/contacts.js b/js/contacts.js index 6f5602c2..0654976a 100644 --- a/js/contacts.js +++ b/js/contacts.js @@ -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'); }