jQuery is probably worth learning if you plan on getting serious, but this can be done with a simple javascript file:
//saved as javascript.js
var formId = "searchPersonForm";
var inputArray = [];
for(var x=0;x < 10;x++){
var newId = x*100
var newInput = document.createElement("input")
newInput.id = "person_id_" + newId
inputArray.push(newInput);
}
for(var x=0;x < inputArray.length;x++){
document.getElementById(formId).appendChild(inputArray[x])
console.log(inputArray[x].id)
}
And just include the script in your page at some point after the form is instantiated:
<html>
<head>
</head>
<body>
<form id="searchPersonForm" action="#" th:object="${person}" method="post">
<input type="text" class="form-control" id="person_id" th:field="*{person_id}"></input>
<input type="text" class="form-control" id="child_id" th:field="*{child_id}"></input>
<script src="javascript.js"></script>
</form>
</body>
Output:
person_id_0
javascript.js:11 person_id_100
javascript.js:11 person_id_200
javascript.js:11 person_id_300
javascript.js:11 person_id_400
javascript.js:11 person_id_500
javascript.js:11 person_id_600
javascript.js:11 person_id_700
javascript.js:11 person_id_800
javascript.js:11 person_id_900