To find a set of inputs with a specific name:
$(":input[name='" + name + "'")...
You need to somehow define the form if the same name is used in different forms. For instance:
<form id="one">
<input type="text" name="txt">
</form>
<form id="two">
<input type="text" name="txt">
</form>
will be selected with:
$("#one :input[name='txt']")...
Generally speaking, it is a bad idea to use attribute selectors. A good habit to join is to give all of your fields unique field identifiers so you can do this:
$("#fieldId")...
, :
$(":input.fieldclass")...
val() .