I think I understand your question, but I'm not 100% sure. If my understanding is correct, you are trying to iterate through your inputs and get the identifier attribute of each of them.
If this is all you need to do, there is a much simpler way to achieve it.
$('#loginform').submit(function(ev) {
$('input[type=text]', this).each(function(index, element) {
alert($(element).attr('id'));
});
ev.preventDefault();
});
So quick crash:
- Firstly, it
$('input[type=text]', this)receives all text inputs from the form we submit. .each().element .attr() alert() .