JSFiddle - React, Tailwind, and code Playground
HTML
<div id="hello">the sample</div>
JavaScript
$("#hello").queue("xxx",function(){
$("#hello").append("<br />queued");
$("#hello").dequeue("xxx");
});
setTimeout(function(){
$("#hello").queue("xxx",function(){
$("#hello").append("<br />queued2");
});
},2000);
setTimeout(function(){
$("#hello").dequeue("xxx");
},3000);
$("#hello").append("<br />before dequeue");
$("#hello").dequeue("xxx");
$("#hello").append("<br />after dequeue");