Getting the name of the field that has had its value changed

Hi guys,

I have a input field array, and have associated a change JQuery event handler if the value of any of the fields in the array have changed. So:


<input type='text' name='field[0]'>
<input type='text' name='field[1]'>

and…


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

In the Javascript, how can I retrieve the name (or index to be more precise) of the field that has had its value changed?

Many thanks.


$("[id^=field]").change(function() {

var index = $('input').index(this);

}

Beautiful. Figured it would be something very simple indeed. Much thanks!