0

So, I have this table where I have text field beside each product and I am to input the value in any selected text field via a number pad( buttons from 0-9). I need to know how can I get the id value of currently selected text field, and add numbers as text to it using the numberpad.

1 Answers1

0

You need to use this.id to get the ID of the particular element. For example, when I have done a snippet that says the ID once you press Enter key.

<input id="this-is-id"
       onkeyup="if (event.keyCode == 13) alert(this.id);" />
Praveen Kumar Purushothaman
  • 164,888
  • 24
  • 203
  • 252