NOTE:
Each email ID must be unique.
An empty string value is allowed to be added.
Email IDs should be separated by semicolons and commas.
Basic validation of email IDs is necessary for entry.
[![
$("#d-notification").focusout(function () {
var conditions = [".com", ".in", "@"];
var d = document.getElementById("d-notification").value;
var res = conditions.some(el => d.includes(el));
if (d !== "" && res === false) {
document.getElementById("error-d").style.display = "block";
$("#generate-dispatcher").attr("disabled", true);
} else {
document.getElementById("error-d").style.display = "none";
$("#generate-dispatcher").attr("disabled", false);
}
});
#error-d {
display:none;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div>
<textarea type="text" id="d-notification" class="form__field resize"
placeholder="Enter the Email ID"></textarea>
<span id="error-d" class="error-noti">Please Enter valid Email ID</span>
</div>