JSFiddle - React, Tailwind, and code Playground

by sridhar reddy

HTML

<div id="div">
  <input type="number" data-id="id0" name="value[]" placeholder="Введите 't'">
  <input type="number" data-id="id0" name="value[]" placeholder="Введите 'C'">
  <input type="number" data-id="id0" name="value[]" placeholder="Введите 'Q'">
</div>
<input type="button" id="button" value="Добавить">
<script>
	var count = 1;
var count2 = 1;
var count3 = 1;
var button = document.getElementById('button')
button.addEventListener("click", function(){
var input = document.createElement('INPUT');
input.type = 'number';
input.setAttribute("data-id", "id" + count);
//input2.setAttribute("style", "margin-right: '5px'");
input.name = "value[]";
input.placeholder = "Введите 't'";
document.querySelector('#div').appendChild(input);
count++;
var input2 = document.createElement('INPUT');
input2.type = 'number';
input2.setAttribute("data-id", "id" + count2);
//input2.setAttribute("style", "margin-right: '5px'");
input2.name = "value[]";
input2.placeholder = "Введите 'C'";
document.querySelector('#div').appendChild(input2);
count2++;
var input3 = document.createElement('INPUT');
input3.type = 'number';
input3.setAttribute("data-id", "id" + count3);
//input3.setAttribute("style", "margin-right='5px'");
input3.name = "value[]";
input3.placeholder = "Введите 'Q'";
document.querySelector('#div').appendChild(input3);
count3++;
</script>