How do I find which text field

How do I find which text field

I have three input text fields and when I click F4 I display a jQuery-UI
dialog which mainly consist of a html table this works fine.
I select a row in the html table in the jQuery-UI dialog by double click and
in the event handler I can extract the values from the selected row.
All this work fine.

Now starts the problem because I can click F4 and display the same JQuery-UI
dialog in all three text fields I must be able
to know which text field I standing in when I double click in the html
table that exist in  jQuery-UI dialog.

What can I do to know that ?

Here is the event handler that is called when  I double click in table with
id=ort.
If I keep this code then only text field with id = prevPortID will get value
from the selected row
in the html table that exist in the jquery-UI

$("#ort").dblclick(function (event)
          {
              var row = $(event.target).closest('tr');

              $('#dlgSearchOrt').dialog("close");

              $('#prevPortID').val(row.find('td:eq(0)').text());
          });

//Tony