If you have multiple elements with the same identifier, you have invalid HTML.
But you can get the same result using classes. This is what they are for.
<input class='b' ... >
You can also specify its identifier if you need, but it must be unique.
Once you have a class, you can reference it with a dot instead of a hash, for example:
var value = $('#a .b').val();
or
var value = $('#a input.b').val();
which will limit it to the elements of class "b", which are inputs in the form (which is similar to what you are asking).
Spudley
source share