How to allow literal tab character in text input? [duplicate]

I am making a website. I can change the HTML/JS.

How do I let a tab press in input type="text" capture the tab character instead of advancing into the next input?

For example:

  • HTML: <input type="text"><input type="submit">

If I type a<tab>b, then the input should have contents a b (not space, tab). The default is having a as contents, then tab changes focus to submit button.