Here is my code. I am using role="textbox" and getting value from it. But, when I enter more than one line of text in the textbox, it gives me the value in multiple lines. How do I get this value in a single line?
function getText() {
let text = document.querySelector('[role=textbox]').innerText;
alert(text);
}
.textbox{
border: 1px solid;
}
<div>
<div id="txtboxLabel">Enter your five-digit zipcode</div>
<button onclick=getText()>
Get TextBox Data
</button>
<div class="textbox" role="textbox" contenteditable="true" aria-labelledby="txtboxLabel"></div>
</div>