Determining index of array input that has changed

Hi,

I have a set of array indexed input fields i.e. field[0], field[1] etc.

I have a change event handler associated to them using jquery:

$("[id^=field]").change(function() {
// code here
});

I was wondering if there’s a simple way I could determine the index of the field input that has been changed.

Thanks.

For what purpose?

The data set sent via AJAX will consist of the value of the indexed field that has changed, as well as the value of a number of other fields of the same index.

It should be possible to use $.makeArray() to convert a selection in to an array, and [url=“http://api.jquery.com/jQuery.inArray/”]$.inArray() to find the location of an element within that array.

Thanks for that. I’ll try it out!