JSFiddle - React, Tailwind, and code Playground
HTML
<div id="validDiv01">
<input />
<input />
<input />
</div>
<hr />
<div id="validDiv02">
<input />
<input />
<input />
</div>
<hr />
<div id="validDiv03">
<input />
<input />
<input />
</div>
JavaScript
function ISeeWhatYouDidThere(e) {
var $repeat = 0,
$val = e.val(),
$parent = "#" + e.closest("div").attr("id")
;
if($.trim($val) == "")
return;
e.removeClass("ui-state-error");
$("input", $parent).each(function() {
if($(this).val() == $val)
$repeat++;
});
if($repeat <= 1)
return;
alert("Repetido!");
e.addClass("ui-state-error");
}
/////////////////////////////////
$("input","div").blur(function(){
ISeeWhatYouDidThere(
$(this)
);
});