I have a button and I want to change its label from say 1 to 2, so that 1 slides up and meanwhile 2 replaces it. It's what I tried in the snippet. However, nothing is shown in the end. Please note that 1 and 2 are examples, in general it should replaces the old value with a new value on an event.
$('#slideIndexBox').slideDown().promise().done(function() {
$(this).text('2');
$(this).slideUp();
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<button id="indicator" class="btn mb-2 btn-block btn-outline-info ">
<!--<span id="slideIndicator"></span>-->
<span id="slideIndexBox">1</span>
</button>