function checkinput() { var o={}; $('input').each(function(i) { if(!(o[$(this).val()])){ o[$(this).val()] = true; }else{ alert('有重复的') } }) }