Answers for "css permit tabs on textarea react"

1

js tab in textarea

document.querySelector('#textarea').addEventListener('keydown', e => {
	if ( e.key === 'Tab' && !e.shiftKey ) {
		// execCommand operations are "Cmd|Ctrl+Z"-able
      	// note: execCommand is deprecated and may not work in the future
		document.execCommand('insertText', false, "\t");
		e.preventDefault();
		return false;
	}
});
Posted by: Guest on July-07-2020
0

css permit tabs on textarea react

<ConfigurationInput onKeyDown={e => {
   if ( e.key === 'Tab' && !e.shiftKey ) {
   document.execCommand('insertText', false, "\t");
   e.preventDefault();
   return false;
}}}/>
Posted by: Guest on July-09-2020

Code answers related to "TypeScript"

Browse Popular Code Answers by Language