Skip to content

Commit 2cff0a3

Browse files
committed
Trim leading en trailing
1 parent d6c8f35 commit 2cff0a3

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

web/js/src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import handleStickyToolbar from './stickyToolbar';
2424
import handleSyncEmailValues from './syncEmailValues';
2525
import handleTabPanels from './tabPanels';
2626
import handleToggleAdvanced from './toggleAdvanced';
27+
import trimInput from './trimInput';
2728
import handleUnlimitedInput from './unlimitedInput';
2829
import initRrdCharts from './rrdCharts';
2930
import initWebTerminal from './webTerminal';
@@ -51,6 +52,7 @@ function initListeners() {
5152
handleSyncEmailValues();
5253
handleTabPanels();
5354
handleToggleAdvanced();
55+
trimInput();
5456
initRrdCharts();
5557
initWebTerminal();
5658
}

web/js/src/trimInput.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//trim leading / trailing spaces form input fields
2+
export default function trimInput() {
3+
document.querySelectorAll('input[type="text"]').forEach((input) => {
4+
input.addEventListener('change', function () {
5+
this.value = this.value.trim();
6+
});
7+
});
8+
}

0 commit comments

Comments
 (0)