Created
December 8, 2016 19:12
-
-
Save rodriigomedeiros/581e3d5cb5d49a9ee9cd580ad67269e2 to your computer and use it in GitHub Desktop.
Verifica a duplicidade de names em campos de formulários
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Interesting, thanks for share it.