0

For every web browser, pressing the Tab key cycles through selecting the various input elements / links etc. on the page. I want to make it so that when a user presses Tab in a<textarea>, it creates a "tab" character like in a text document. How can that be done?

GMchris
  • 5,439
  • 4
  • 22
  • 40
  • As explained by **@Dano** this can be done. However, it is almost always a bad idea to surprise the user by changing default behaviours. Think long and hard about whether you **should** be doing this before you work out **how** to do it. You will provide a User eXperience that drives away people who expect your site to follow web conventions and use default behaviours. – jwpfox Oct 17 '16 at 08:17

1 Answers1

1

This has already been answered, for example here. Basically you catch the keypress, prevent default behaviour and indent you textarea instead. For an example, please check out the provided link.

Community
  • 1
  • 1
Dario
  • 582
  • 1
  • 5
  • 17