added clickevent to deleteBtn instead of li item.

and added the missing check for direction.