JSFiddle - React, Tailwind, and code Playground
by revathskumar
HTML
<!doctype html>
<body>
<form><textarea id="foo" name="foo">
sdsdfsd
fasdfsaf
</textarea>
<input type="submit">
</form>
</body>
JavaScript
jQuery(function($){
$("form").submit(function bar(){
baz = document.getElementById('foo').value;
alert((baz.match(/\r/) && 'CR') + ' ' + (baz.match(/\n/) && 'LF'));
document.getElementById('foo').value = "foo\nbar";
lines = foo.value.split(/\r\n|\r|\n/);
console.log(lines);
return false;
})
});