Tutorial Support Tabs in Textareas

Normally the tab key moves to the next focusable thing. This inserts a tab character in instead. HTMLTextAreaElement.prototype.getCaretPosit...

Normally the tab key moves to the next focusable thing. This inserts a tab character in instead.
HTMLTextAreaElement.prototype.getCaretPosition = function () { //return the caret position of the textarea
return this.selectionStart;
};
HTMLTextAreaElement.prototype.setCaretPosition = function (position) { //change the caret position of the textarea
this.selectionStart = position;

Hot in Week

Popular

Archive

item