I want to select all custom attributes and do a validation with them, but I do not know how I can get the value of "attr" inside a loop, since they are being iterated.
HTML example:
<input type="text" data-selected="teste" value="fulano" name="nome">
<input type="text" data-selected="teste2" value="de tal" name="sobrenome">
Example:
$('[data-selected]').each(function(){
alert( $(this).attr() ); // -> teste / teste2
});