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'); 

fiddle

filters inputs based on wether or not input same value exists


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -