I want something like : $(’#input’).append(this.question + “
”);
<body>
<div id="container">
<h1> Press 'Enter' after writing your answer. </h1>
<input type="text" id="input" name="questions[]" />
<input type="text" id="output" />
<input type="text" id="input" name="questions[]" />
<input type="text" id="output" />
<input type="text" id="input" name="questions[]" />
<input type="text" id="output" />
<input type="text" id="input" name="questions[]" />
<input type="text" id="output" />
<input type="text" id="input" name="questions[]" />
<input type="text" id="output" />
<a id="sub" href="#"> Submit </a>
<div id="result"> </div>
</div>
</body>
<script>
$('document').ready(function() {
let questions = [
{
question: "1. I like tea.",
answer: "I do not like tea."
},
{
question: "2. You are my friend.",
answer: "You are not my friend."
},
{
question: "3. She is very naughty.",
answer: "She is not very naughty"
},
{
question: "4. You can do it.",
answer: "You cannot do it"
},
{
question: "5. They are good.",
answer: "They are not good."
},
];
$.each(questions, function() {
$('#result').append(this.question + "<br>");
});
});
</script>