JSFiddle - React, Tailwind, and code Playground
HTML
<input id="Textbox1" type="text" value="A123456,foo,bar,too-looong,B123456,C123456,D123456" />
<button id="validateButton">validate</button>
JavaScript
function validate() {
var val = document.getElementById("Textbox1").value,
err = $.grep(val.split(','), function(a) { return a.length != 7; });
if (err.length) {
alert("All entries must be seven (7) characters in length. Please correct the following entries: \n" + err);
return false;
}
return true;
}
$('#validateButton').click(function() { validate(); });