Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tabbing in text boxes

How can I make a text box that allows users to enter tabs, and does not send the user to the next element when the tab button is pressed?

like image 449
UnkwnTech Avatar asked Dec 03 '22 16:12

UnkwnTech


2 Answers

You only need to check for tabs onkeydown via event.keyCode === 9. Inserting the character into the textarea is non-trivial - use a library or google for 'insertatcaret'.

like image 75
Christoph Avatar answered Dec 29 '22 17:12

Christoph


There are already some plug-ins for jQuery that do this. One for example is Tabby.

like image 22
Gumbo Avatar answered Dec 29 '22 17:12

Gumbo