javascript: enter key handling with multiple submit buttons?
I have a dynamically generated (html) table that looks like this:
thing thing thing <submit button1>
thing thing thing <submit button2>
field field field <submit button3>
where "things" are text that's pulled from the db
button1 & button2 are "edit" buttons that will activate a row for editing.
button3 is a "save" button that will save a new row from user input. The number of rows/columns varies greatly depending on context.
I would like to be able to hit the Enter key & the correct button be clicked. The "correct" button is the one that's in the same row as the text that's being edited.
Does anyone know of a slick method of doing this? Hell, I'd even take a cumbersome method at the moment. I know how to look for a key event on a single field & have it click a single submit button, but how do you handle multiple fields & multiple buttons?
|