Apply IMask to created element

109 Views Asked by At

I want to be able to press a button and create two new inputs below the button, the first input needs to be formatted by imask as follows: 00:00:00

Currently I can only do that to the inputs I create manually. How can I add IMask configs to every created button? Here is my function that creates the inputs.

const createInputs = event => {
    var child_location = document.getElementById('inputs');

    var duration = document.createElement('input');
    duration.id = 'input1'
    child_location.parentNode.appendChild(duration);


    var title = document.createElement('input');
    title.id = 'title'
    child_location.parentNode.appendChild(title);

    var lineBreak = document.createElement('br');
    child_location.parentNode.appendChild(lineBreak);
}
0

There are 0 best solutions below