Skip to content

Commit 993d74e

Browse files
committed
remove jq and fix value check
1 parent e72b39c commit 993d74e

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

web_src/js/features/tag-name-editor.js

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import $ from 'jquery';
21
import {hideElem, showElem} from '../utils/dom.js';
32

43
export function initTagNameEditor() {
@@ -12,18 +11,18 @@ export function initTagNameEditor() {
1211
const newTagHelperText = el.getAttribute('data-tag-helper-new');
1312
const existingTagHelperText = el.getAttribute('data-tag-helper-existing');
1413

15-
$('#tag-name').on('keyup', (e) => {
14+
document.getElementById('tag-name').addEventListener('keyup', (e) => {
1615
const value = e.target.value;
1716
if (existingTags.includes(value)) {
1817
// If the tag already exists, hide the target branch selector.
19-
hideElem($('#tag-target-selector'));
20-
$('#tag-helper').text(existingTagHelperText);
18+
hideElem('#tag-target-selector');
19+
document.getElementById('tag-helper').innerText = existingTagHelperText;
2120
} else {
22-
showElem($('#tag-target-selector'));
23-
if (typeof value === 'string' && value.length > 0) {
24-
$('#tag-helper').text(newTagHelperText);
21+
showElem('#tag-target-selector');
22+
if (value) {
23+
document.getElementById('tag-helper').innerText = newTagHelperText;
2524
} else {
26-
$('#tag-helper').text(defaultTagHelperText);
25+
document.getElementById('tag-helper').innerText = defaultTagHelperText;
2726
}
2827
}
2928
});

0 commit comments

Comments
 (0)