Split newline string using comma
Hi,
I need a javascript to split newline characters with commas. The below one, I am able to split white space and not the new line. Can anyone help me?
<html>
<head>
<script>
function convert() {
var data = document.getElementById("get").value;
var lines = data.split(' ');
document.getElementById("display").value = lines.join(',');
}
</script>
</head>
<body>
<div>
Enter Code:
</br>
<textarea id="get"> </textarea>
</br>
<input type="button" value='Convert' onclick="convert()"/>
</br>
<textarea id="display"> </textarea>
</div>
</body>
</html>