JSFiddle - React, Tailwind, and code Playground

by Darker

HTML

<link rel="stylesheet" href="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<div id="my-dialog" style="display:none" title="Interval info">Interval: <span id="counter">0</span></div>

JavaScript

// Configure the div as dialog, call this only once
    $("#my-dialog").dialog({modal:true,
                            autoOpen: false,
                            buttons: {
                              Ok: function() {
                                $( this ).dialog( "close" );
                              }
                            }
    });
    var counter = 0;
    
    var intervalID = setInterval(function() {
       
      // Update counter info
      $("#counter").html(++counter);
      // Show dialog
      $("#my-dialog").dialog("open");
    }, 1000);