JSFiddle - React, Tailwind, and code Playground
by amantur
HTML
<textarea>
An item with this x Id already exists.
An item with this y id already exists.
An item with this barcode already exists.
</textarea>
<br/>
<button text="check" id="chk"/>check</button>
JavaScript
function checkIt(msg) {
alert("[" + msg + "]");
var aLines = msg.split(/\r?\n+/);
for (var i in aLines) {
if (!aLines[i]) {
alert("Error!\r\n["+aLines[i]+"]");
continue;
}
alert(i + ": \"" + aLines[i] + "\"");
}
}
$(function() {
$("#chk").click(function() {
var a="";
if(!a){
alert("!a");
}
checkIt($("textarea").val());
});
});