Got the following JS code.
<script language="javascript">
fields = 0;
pNR = 0;
err=0;
function addInput() {
if (fields != 40) {
var firstInput = document.createElement("input");
var secondInput = document.createElement("input");
firstInput.type = secondInput.type = "text";
firstInput.name = "firstfield" + pNR;
secondInput.name = "secondfield" + pNR;
var text = document.getElementById("text");
text.appendChild(firstInput);
text.appendChild(secondInput);
text.appendChild(document.createElement("br"));
fields += 1;
pNR += 1;
} else ...
</script>
I want to set a class for each tag created.
The class should be the name of the field and "required":class="firstfield0 required"`