Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tab in a textarea

Status
Not open for further replies.

webmigit

Programmer
Aug 3, 2001
2,027
US
I'd like let users put a tab in a textarea... Like this " ". Right now they write it up in notepad and then c&p..

Is there javascript to do this? An html option?

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
You will have to build your own keyboard handler which overrides the onkeydown event (unfortunately, onkeypress does not fire for the tab key) which cancels the default behaviour of moving to the next field, and inserts a tab character instead.

Try searching on Google for "textarea tab" for more information - this page was the first result that showed up for me... And although it is more of a .net thing, the principles should be the same.


Hope this helps,
Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top