Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js message timeout

function sendFeedback(message, timeout = 5000)
{
    let feedbackItem = document.querySelector('[item-type="feedback"]');

    if (!feedbackItem) {
        return;
    }

    feedbackItem.innerHTML = message;
    feedbackItem.classList.add('active');

    setTimeout(() => {
        feedbackItem.feedbackItem.innerHTML = '';
    }
    , timeout);
}
 
PREVIOUS NEXT
Tagged: #js #message #timeout
ADD COMMENT
Topic
Name
7+5 =