javascript_pupil,
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<script>
function addField() {
let i = document.querySelectorAll('[name="answers"]').length;
document.getElementById("choice").insertAdjacentHTML('beforeEnd', '<input id="answers[' + i + ']" type="text" name="answers" value="">');
document.getElementById(`answers[${i}]`).focus();
}
</script>
</script>
</head>
<body>
<div id="choice"></div>
<button type="button" onclick="addField()">add</button>
</body>
</html>