How to use Tab key to indent within a textfield (instead of jumping to next element)? [duplicate]

  • For Firefox, the Tabinta addon works well. You can change Tab to insert a tab, and even set an alternate key that advances to the next field (the default behavior of Tab).
  • For any Windows program, you can press Alt+09 (press and hold Alt, press and release numpad 0, press and release numpad 9, release Alt) to insert a tab. You can then copy and paste that resulting tab to your heart's content.
  • For any Mac program, you can press ControlOptionTab to insert a tab. Copy and paste it as needed.

If you want to customize Firefox's default behavior use Tabinta. According to the blurb...

Tabinta lets you insert tab characters in multi-line text input fields. The name itself is a shorthand for "Tab in Textarea".

The default tab key behavior in Mozilla/Firefox textareas is to go to the next form field. This extension is for people who prefer inserting actual tab characters into these fields.

You can alter the default behavior of the Tab key to insert a tab, instead of the usual field tabbing.

Ordinarily, this would be done by the developer of a site using JavaScript...

function keyHandler(e) {
    var tabkey = 9;
    if (e.keyCode == tabkey) {
        this.value += "\t"; \\ could use something like "    " instead
        if (e.preventDefault) {
            e.preventDefault();
        }
        return false;
    }
}

Generally, on Mac OS X, you can press CtrlOptTab to insert a tab character instead of switching focus.

At least in well behaved applications. Firefox ignored many other platform conventions as well, so it's not surprising it fails to behave properly in this case.