0

I have an issue with doing two .html()'s in the same function cause the first one is getting overrun by the second. Any thoughts? This function is getting called when another action is taken, it is working fine, but when I put in the delay and the 2nd html() it doesn't work. Thanks.

function confirmNote() {
    $('#noteConfirm').html('Note Sent').delay(1000).html('Leave a Note');
}

2 Answers 2

3

.delay() only works with functions that go through the animation queue which does not include .html(). You can use a setTimeout() to do what you want.

function confirmNote() {
    $('#noteConfirm').html('Note Sent');
    setTimeout(function() {$('#noteConfirm').html('Leave a Note')}, 1000);
}
Sign up to request clarification or add additional context in comments.

Comments

1
function confirmNote() {
    $('#noteConfirm').html('Note Sent')
    setTimeout(function() {
        $('#noteConfirm').html('Leave a Note');
    }, 1000);
}

Should do the trick. delay only delays animation so is not appropriate in this case.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.