jquery - check if same value exist in an input box -
is there anyway check if similar value exist in input box
ex: <input name="user1" value="bla1"> <input name="user2" value="bla2"> <input name="user3" value="bla1">
the verification trigger when form submitted, alert user , add class both input similar value.
more jquery'ish
var inputs = $('input'); inputs.filter(function(i,el){ return inputs.not(this).filter(function() { return this.value === el.value; }).length !== 0; }).addclass('red');
filters inputs based on wether or not input same value exists