JSFiddle - React, Tailwind, and code Playground

by ksgsharma

HTML

<div id='screencontent'></div>
<button id='testbutton' style='width:30px;height:30px' />

JavaScript

$(document).ready(function () {
    $('#testbutton').on('click', function () {
        var tasks = [1,2,3];
        for (var i = 0; i < tasks.length; i++){
            $(document).queue('tasks', DeleteFunction(tasks[i]));
        }
        $(document).dequeue('tasks');
    });
});



function DeleteFunction(taskNum){
    return function(next){
        fnShowFIN44Form(next);
    }
}



function fnShowFIN44Form(next) {
    var sHtml = '<p>' + 'Test Message' + '</p>';
    var confirmDialogAlreadyExists = $('#dialog-confirm');
    if (confirmDialogAlreadyExists.length <= 0) {
        $('<div id="dialog-confirm" title="">' + sHtml + '</div>').insertAfter('#screencontent');
    } else {
        $('#dialog-confirm').empty();
        $('#dialog-confirm').append(sHtml);
    }  
    
    var funcTrue = function () {
        $(this).dialog("close");
        next();
    };

    var funcFalse = function () {
        $(this).dialog("close");
        next();
    };
    
    var oDialogType = {
        "OK": funcTrue,
        "CANCEL": funcFalse
    };
   
    $("#dialog-confirm").dialog({
        resizable: false,
        modal: true,
        title: 'test',
        closeOnEscape: true,
        draggable: true,
        buttons: oDialogType
    });    
}