JSFiddle - React, Tailwind, and code Playground

by criptkiller

HTML

<div>ola</div>

JavaScript

$("div").click(function (){
    if($(this).html()=='ola'){
        $(this).html('sopa');
    }else{
       $(this).html('ola');
    } 
    setTimeout(window.grava(),1000);
});
var _altera = "";
grava = function (){
    if(_altera==$("div").html()){
        alert('grava');
    }else{
        alert('mais 2 segundos');
        _altera =   $("div").html(); 
    }
}