I created a output document , in each Textarea and Textbox there is a line break i want to know how to remove it
Asked
Active
Viewed 59 times
1 Answers
0
Line break are usually "\n". So if you want to output or show it in a "div" tag, then you go with this code:
function formatData(){
var inpData = document.getElementById("textInput").value.split("\n");
var outputData = "";
for(var i = 0;i < inpData.length; i++){
outputData += inpData[i];
}
document.getElementById("textOutput").innerHTML = outputData;
}
<textarea rows="4" id="textInput"></textarea>
<button onclick="formatData()">Display Formatted Data</button>
<div id="textOutput"></div>

Sushan Sapaliga
- 324
- 5
- 14