Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This question already has an answer here:

An issue that bothers me a while, which I could never found out:

Is there any key / shortcut that I can use to add an indent by TAB key within an input text field (HTML). Like the one I am writing now :)

Over the years I always took a tab jump (indent) from an editor and pasted it to the necessary position within the textfield.

Differently put: Is it necessary to turn off the default tab behaviour to prevent jumping to the next field somehow?

I am very curious if somebody knows an answer.

PS: I am using Firefox 17 but I guess this is browser independent?!

share|improve this question
    
I guess you could use an AutoHotKey script to set up a keyboard shortcut that would paste a Tab character at the current cursor location. –  Karan Dec 21 '12 at 19:14
2  
dup superuser.com/questions/67934/… –  Bratch Dec 21 '12 at 20:34
    
@Bratch Thanks for the hint! Since ALT+09 does not work for me, I will go for the firefox addon tabinta –  Echt Einfach TV Dec 22 '12 at 7:48
add comment

marked as duplicate by Daniel Beck Mar 27 '13 at 22:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3 Answers

up vote 4 down vote accepted
  • 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.
share|improve this answer
    
Nice sum up. Wished there would be a specific key combination for Windows systems as Alt+09 is not working for me in Firefox 17 / Win7. –  Echt Einfach TV Dec 22 '12 at 7:50
add comment

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;
    }
}
share|improve this answer
    
Thanks for your answer! My question, though, is there a key-combination, a shortcut I could use while typing to do the indent? ... How could I call the function you provided by typing into this textfield? –  Echt Einfach TV Dec 21 '12 at 17:28
    
@EchtEinfachTV See my edit. There is a Firefox addon for your situation. Enjoy! –  Ian Atkin Dec 21 '12 at 19:39
add comment

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.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.