i have this text box when i add some lines from this text box then these lines added to something like this structure.
you can check this lines by Copy/Paste and insert to this textbox:
Question-1 : The color of the sky is...?
Question-2 : Paper comes from...?
Question-3 : How many hours in a day?
Question-4 : A Giraffe is a fish?
But now my need is that i want to add one extra class answer in only first line like this:
My All JS Text box Code is that:
const sendButton = document.getElementById('send-btn');
const textArea = document.getElementById('input');
const innerDiv = document.getElementById('inner');
var message = textArea.value;
sendButton.addEventListener('click', function() {
// split the textarea entries into an array
let lines = (textArea.value).split("\n");
// iterate over each line, creating a div/span and inserting into the DOM
lines.forEach( (line) => {
let encodedLine = encodeHtmlEntity(line);
let newElement = `<div class="quiz">${encodedLine}</div>`;
innerDiv.innerHTML += newElement;
});
// reset the textarea
textArea.value = '';
});
function encodeHtmlEntity(input) {
var output = input.replace(/[\u00A0-\u9999<>\&]/gim, function(i) {
return '&#' + i.charCodeAt(0) + ';';
});
return output;
}
<div id="inner"> </div>
<textarea class="input" id="input" placeholder="Message..."></textarea>
<button class="waves-effect waves-light" id="send-btn">add text</button>
How can i do that. plz solve my issue. What some extra lines of code i need to write ?
Thanks in Advance , Love You.

