I want when a person adds any list in the first textarea and click button then in next textarea list should have multiple line breaks. My following code only adds one line break. I want it should add 2, 3.. line breaks.
Please refer this image:
Code:
function myFunction() {
document.getElementById('TextInput2').value = document.getElementById('TextInput1').value.replace(/[\r\n]{2,}/g, "\n");
}
<html>
<body>
<textarea autocomplete="off" cols="30" id="TextInput1" name="message" rows="10" style="width: 100%;"></textarea>
<br><br>
<center><button onclick="myFunction()">Click me</button></center>
<br>
<textarea autocomplete="off" cols="30" id="TextInput2" name="message" rows="10" style="width: 100%;"></textarea>
</body>
</html>