During the development of the new Coding Source Admin Section, the textarea needed the ability to use the TAB key for particular code examples.
Using the [
Tab] key with a textarea of your webpage gives more freedom to the visitor or the administrator than not having the feature available to you.
Doing a quick check through Google, I came across an Answer on
stackoverflow.com«.
The code works well and without much change to make it work for your needs.
In the below [
Source Code], you will see a great example of how to use this fantastic code used on this site.
Adding an Event Listener to the keydown function of the textarea, removing its default purpose of use, and giving you the ability to tab through the textarea makes your HTML page work more like a word or text document editor than a typical HTML document.