javascript - jquery animate complete function executing before animation is comlete -


i want remove li of ul after animation completed makes li remove before completion. please me solve

$('#btngo').click(function() {    var $ulcust = $('#divcust ul');    $ulcust.find('li:first').animate({     opacity: 0.25,     left: 915   }, 'slow', function() {     //this function executes before animation completes     $('#btngo').delay(2000).html('complete'); //this delay not working                        console.log('complete');     //$(this).delay(100000).remove();                    });  }) }); 

try this

$('#btngo').click(function () {     var $ulcust = $('#divcust ul');     $ulcust.find('li:first').animate({         opacity: 0.25,         left: 915         complete: function () {             $('#btngo').html('complete');         }     }); }); 

Comments