js tab in textarea css permit tabs on textarea react

The solution for “js tab in textarea css permit tabs on textarea react” can be found here. The following code will assist you in solving the problem.

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;
}
}); {
if ( e.key === ‘Tab’ && !e.shiftKey ) {
document.execCommand(‘insertText’, false, “\t”);
e.preventDefault();
return false;
}}}/>

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in