Skip to content

Instantly share code, notes, and snippets.

@rodriigomedeiros
Created December 8, 2016 19:12
Show Gist options
  • Save rodriigomedeiros/581e3d5cb5d49a9ee9cd580ad67269e2 to your computer and use it in GitHub Desktop.
Save rodriigomedeiros/581e3d5cb5d49a9ee9cd580ad67269e2 to your computer and use it in GitHub Desktop.
Verifica a duplicidade de names em campos de formulários
var $inputs = $('[name]'), names = [], namesDuplicados = [];
$.each($inputs, function(index, value){
var $this = $(value);
if(names.indexOf($this.attr('name')) != -1){
namesDuplicados.push($this.attr('name'));
}
names.push($this.attr('name'));
});
console.log(namesDuplicados);
@fanthomIII
Copy link

Interesting, thanks for share it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment