将值分配给输入名称不唯一的特定输入

I'm kinda new to js/php programming and have to jump into someone elses code. :/

I have a page with 2 different divs that contains each a table:

<div location="A"...><table location="A"...><input type="text" id="SomeID"...>
<div location="B"...><table location="B"...><input type="text" id="SomeID"...>

On a click of a btn, it uses Ajax to get values to populate these fields. Once I have the values, the following code updates the input box

$('#SomeID').val('Obtained value').trigger('change');

All this works kinda ok except for one thing... How can I specify which $('#SomeID') to update (the one from location A or location B)?

If you want the value of location, you can use :

$('#SomeID').attr('location').val();

Use attribute selector:

$('div[location="A"]').val('Obtained value').trigger('change');//for location A

and

$('div[location="A"]').val('Obtained value').trigger('change');//for location B

Please update your question if you didn't mean to ask this so that it can be more clear.

I hope it helps