Well my problem is as follows, with the appendChild of JavaScript I create an input with value X with its own ID but it can be random, and I add another with the same method with the same situation as the other but with a different value (Leading on account that X is a numeric value) well, my problem is that I do not know how I will add or subtract those input's having random id's as they are created or removed. I'm grateful if you can help me. Here is the code I use to create:
function adicionar(conteudo) {
var node = document.createElement("input");
dados = conteudo.split('|'); //separa a id do valor e cria um array nos dados
node.setAttribute("id", dados[0]); //insere a id
node.setAttribute("type", "text"); //insere o tipo
node.setAttribute("value", dados[1]); //insere o valor
document.getElementById("lista").appendChild(node); //escreve na div
}
<div id="lista"></div>
<!--a esquerda a id a direia o valor-->
<button onclick="adicionar('1|5');">adicionar input 1</button>
<button onclick="adicionar('2|7');">adicionar imput 2</button>