Keypress in jQuery: Press TAB inside TEXTAREA (when editing an existing text)

前端 未结 4 413
一个人的身影
一个人的身影 2020-12-30 12:47

I want to insert TAB characters inside a TEXTAREA, like this:


I can

4条回答
  •  孤城傲影
    2020-12-30 13:05

    Unfortunately, manipulating the text inside textarea elements is not as simple as one might hope. The reason that Tabby is larger than those simple snippets is that it works better. It has better cross-browser compatibility and handles things like tabbing selections.

    When minified, it's only about 5k. I'd suggest using it. You'll either have to discover and troubleshoot those same edge cases yourself anyway, or might not even know about them if users don't report them.

提交回复
热议问题