JSFiddle - React, Tailwind, and code Playground

by Alfie

HTML

<button>create</button>

JavaScript

var intVal = null;
    intVal = setInterval(function () {
        if ($('.interval').length > 0) {
            $('.interval').val(function () {
                return ++this.value
            });
        }
    }, 1000);


    function Create() {
        var $element = $('<input/>', {
            class: "interval",
            value: "0"
        });
        $element.appendTo('body');
    }
    $('button').on('click', Create);
    Create();